NAME
REST::Google::Apps::Provisioning - A Perl library to Google's RESTful Apps Provisioning API
SYNOPSIS
= REST::Google::Apps::Provisioning->new(
domain
=>
'company.com'
,
username
=>
'admin'
,
password
=>
'g00gl34pp5!'
);
$user
->{
'jsmith'
} =
->getUser(
username
=>
'jsmith'
);
DESCRIPTION
REST::Google::Apps::Provisioning provides a Perl interface to Google's RESTful Apps API.
CONSTRUCTOR
new ( DOMAIN, USERNAME, PASSWORD )
Creates a new REST::Google::Apps::Provisioning object. A domain parameter is required.
Supplying authentication information to the constructor is optional, but needs to happen either here or with a call to the authenticate method.
Example
= REST::Google::Apps::Provisioning->new(
domain
=>
'company.com'
,
username
=>
'admin'
,
password
=>
'g00gl34pp5!'
);
METHODS
authenticate ( USERNAME, PASSWORD )
Authenticate a session.
Example
->authenticate(
username
=>
'admin'
,
password
=>
'g00gl34pp5!'
)
||
die
"Could not authenticate"
;
createUser ( USERNAME, GIVENNAME, FAMILYNAME, PASSWORD, PASSWORDHASHFUNCTION, ADMIN )
Create a new user.
The following parameters are required:
- username
-
The username associated with the account being created.
- givenName
-
The user's given (first) name.
- familyName
-
The user's family (last) name.
- password
-
The user's password.
The following parameters are optional:
- passwordHashFunction
-
The format of the value in the password attribute. Currently, the only valid values for this parameter are "SHA-1" and "MD5".
- admin
-
Can be 'true' or 'false', representing whether or not the user should be granted administrator access.
Example
$user
->{
'jsmith'
} =
->createUser(
username
=>
'jsmith'
,
givenName
=>
'Joseph'
,
familyName
=>
'Smith'
,
password
=>
'j5m1thp455w0rd!'
)
||
die
"Could not create user"
;
deleteUser ( USERNAME )
Delete a user.
Example
delete
$user
->{
'jsmith'
}
if
->deleteUser(
username
=>
'jsmith'
);
renameUser ( USERNAME, NEWNAME )
Rename a user.
Example
->renameUser(
username
=>
'jsmith'
,
newname
=>
'josephsmith'
)
||
die
"Could not rename user"
;
updateUser ( USERNAME, ATTR )
Update a user's attributes. See the createUser function for a list of valid attributes.
Example
->updateUser(
username
=>
'jsmith'
,
givenName
=>
'Joey'
)
||
die
"Could not update user"
;
getUser ( USER )
Retrieve a hash containing a user's account information.
Example
$user
->{
'jsmith'
} =
->getUser(
username
=>
'jsmith'
);
Hash
Using the above example, the returned hash is:
'jsmith'
=> {
'admin'
=>
'false'
,
'ipWhitelisted'
=>
'false'
,
'suspended'
=>
'false'
,
'limit'
=>
'7168'
,
'username'
=>
'jsmith`'
,
'changePasswordAtNextLogin'
=>
'false'
,
'givenName'
=>
'Joseph'
,
'familyName'
=>
'Smith'
,
'agreedToTerms'
=>
'false'
}
getAllUsers
Retrieve a list of all users.
Example
$users
=
->getAllUsers();
createGroup ( GROUP, DESCRIPTION, PERMISSION )
Create a new group.
The following parameters are required:
The following parameters are optional:
- description
-
A longer description of the group.
- permission
-
The permission level of the group. Valid values are:
Example
->createGroup(
group
=>
'finance'
,
description
=>
'Finance Department'
)
||
die
"Could not create group"
;
deleteGroup ( GROUP )
Delete a group.
Example
delete
$group
->{
'finance'
}
if
->deleteGroup(
group
=>
'finance'
);
updateGroup ( GROUP, ... )
Not yet implemented.
getGroup ( GROUP )
Retrieve a hash containing group information.
Example
$group
->{
'finance'
} =
->getGroup(
group
=>
'finance'
);
Hash
Using the above example, the returned hash is:
'finance'
=> {
'emailPermission'
=>
'Anyone'
,
'groupId'
=>
'finance@company.com'
,
'updated'
=>
'2009-09-16T21:05:15.697Z'
,
'groupName'
=>
'finance'
,
'description'
=>
'Finance Department'
}
getAllGroups
Retrieve a list of all groups.
Example
$groups
=
->getAllGroups();
addGroupMember ( GROUP, MEMBER )
Add a member to a group.
Example
->addGroupMember(
group
=>
'finance'
,
member
=>
'jsmith'
)
||
die
"Could not add group member"
;
deleteGroupMember ( GROUP, MEMBER )
Remove a member from a group.
Example
->deleteGroupMember(
group
=>
'finance'
,
member
=>
'jsmith'
)
||
die
"Could not delete group member"
;
getGroupMembers ( GROUP )
Retrieve a list of group members.
Example
$group
->{
'finance'
}->{
'members'
} =
->getGroupMembers(
group
=>
'finance'
);
Hash
Using the above example, the returned hash is:
'members'
=> {
'jsmith'
=> {
'memberType'
=>
'User'
,
'directMember'
=>
'true'
,
'memberId'
=>
'jsmith@company.com'
},
'sschneid'
=> {
'memberType'
=>
'User'
,
'directMember'
=>
'true'
,
'memberId'
=>
'sschneid@company.com'
}
}
addGroupOwner ( GROUP, OWNER )
Add an owner to a group.
Example
->addGroupOwner(
group
=>
'finance'
,
owner
=>
'jsmith'
)
||
die
"Could not add group owner"
;
deleteGroupOwner ( GROUP, OWNER )
Remove an owner from a group.
Example
->deleteGroupOwner(
group
=>
'finance'
,
owner
=>
'jsmith'
)
||
die
"Could not delete group owner"
;
getGroupOwner ( GROUP, OWNER )
Not yet implemented.
getGroupOwners ( GROUP )
Retrieve a list of group owners.
Example
$group
->{
'finance'
}->{
'owners'
} =
->getGroupOwners(
group
=>
'finance'
);
Hash
Using the above example, the returned hash is:
'owners'
=> {
'jsmith'
=> {
'email'
=>
'jsmith@company.com'
,
'type'
=>
'User'
},
'sschneid'
=> {
'email'
=>
'sschneid@company.com'
,
'type'
=>
'User'
}
}
createNickname ( USERNAME, NICKNAME )
Create a nickname (e-mail alias).
Example
->createNickname(
username
=>
'jsmith'
,
nickname
=>
'joe'
)
||
die
"Could not create nickname"
;
deleteNickname ( NICKNAME )
Delete a nickname (e-mail alias).
Example
->deleteNickname(
nickname
=>
'joe'
);
getNickname ( NICKNAME )
Retrieve a nickname.
Example
$nickname
->{
'frank'
} =
->getNickname(
nickname
=>
'frank'
);
Hash
Using the above example, the returned hash is:
'frank'
=> {
'name'
=>
'frank'
,
'username'
=>
'jsmith'
}
getUserNicknames ( USERNAME )
Retrieve a list of a user's nicknames.
Example
$user
->{
'jsmith'
}->{
'nicknames'
} =
->getUserNicknames(
username
=>
'jsmith'
);
getAllNicknames
Retrieve a list of all nicknames.
AUTHOR
Scott Schneider <sschneid@gmail.com>