initial commit

This commit is contained in:
Alexis Lazcano 2024-12-17 15:26:19 -06:00
commit 9c7a8c12f3
9 changed files with 414 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
*.TempPoint.*
*.Export.*
*.psprojs
*.RestorePoint.*
*.Run.ps1
*.Package.ps1
CustomMenu.inf
Test-*.ps1

138
PSIsonas.psd1 Normal file
View File

@ -0,0 +1,138 @@
<#
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2024 v5.8.251
Created on: 12/17/2024 10:35 AM
Created by: Alexis Lazcano
Organization: Saratoga Corporate Management Group, LLC
Filename: PSIsonas.psd1
-------------------------------------------------------------------------
Module Manifest
-------------------------------------------------------------------------
Module Name: PSIsonas
===========================================================================
#>
@{
# Script module or binary module file associated with this manifest
RootModule = 'PSIsonas.psm1'
# Version number of this module.
ModuleVersion = '1.0.0.0'
# ID used to uniquely identify this module
GUID = '1fd60578-734d-4e9e-8c94-8f45bd4b92aa'
# Author of this module
Author = 'Alexis Lazcano'
# Company or vendor of this module
CompanyName = 'Saratoga Corporate Management Group, LLC'
# Copyright statement for this module
Copyright = '(c) 2024. All rights reserved.'
# Description of the functionality provided by this module
Description = 'Powershell wrapper for Isonas Pure Access Cloud.'
# Supported PSEditions
# CompatiblePSEditions = @('Core', 'Desktop')
# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '5.1'
# Name of the Windows PowerShell host required by this module
PowerShellHostName = ''
# Minimum version of the Windows PowerShell host required by this module
PowerShellHostVersion = ''
# Minimum version of the .NET Framework required by this module
DotNetFrameworkVersion = '4.5.2'
# Minimum version of the common language runtime (CLR) required by this module
# CLRVersion = ''
# Processor architecture (None, X86, Amd64, IA64) required by this module
ProcessorArchitecture = 'None'
# Modules that must be imported into the global environment prior to importing
# this module
RequiredModules = @()
# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
# Script files (.ps1) that are run in the caller's environment prior to
# importing this module
ScriptsToProcess = @()
# Type files (.ps1xml) to be loaded when importing this module
TypesToProcess = @()
# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @()
# Modules to import as nested modules of the module specified in
# ModuleToProcess
NestedModules = @()
# Functions to export from this module
FunctionsToExport = @(
'Get-IsonasRequestHeaders',
'Test-IsonasConnection',
'Get-IsonasUsers'
) #For performance, list functions explicitly
# Cmdlets to export from this module
CmdletsToExport = '*'
# Variables to export from this module
VariablesToExport = '*'
# Aliases to export from this module
AliasesToExport = '*' #For performance, list alias explicitly
# DSC class resources to export from this module.
#DSCResourcesToExport = ''
# List of all modules packaged with this module
ModuleList = @()
# List of all files packaged with this module
FileList = @()
# Private data to pass to the module specified in ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{
#Support for PowerShellGet galleries.
PSData = @{
# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()
# A URL to the license for this module.
# LicenseUri = ''
# A URL to the main website for this project.
# ProjectUri = ''
# A URL to an icon representing this module.
# IconUri = ''
# ReleaseNotes of this module
# ReleaseNotes = ''
} # End of PSData hashtable
} # End of PrivateData hashtable
}

82
PSIsonas.psm1 Normal file
View File

@ -0,0 +1,82 @@
<#
===========================================================================
Created on: 12/17/2024 10:35 AM
Created by: Alexis Lazcano
Organization: Saratoga Corporate Management Group, LLC
Filename: PSIsonas.psm1
-------------------------------------------------------------------------
Module Name: PSIsonas
===========================================================================
#>
Function Get-IsonasRequestHeaders
{
$tokenPair = "$env:ISONAS_TokenID`:$env:ISONAS_TokenValue"
$tokenBase64 = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($tokenPair))
$Headers = @{
'Authorization' = "Basic $tokenBase64"
'Content-Type' = 'application/merge-patch+json'
}
return $Headers
}
function Test-IsonasConnection
{
$API_Users = $env:ISONAS_API_URL + "users"
$Response = Invoke-RestMethod -Uri "$API_Users/?includeDisabled=false&limit=1" -Headers $(Get-IsonasRequestHeaders)
if ($Reponse.Status -eq "Success") { return $true }
else
{
return $false
}
}
function Get-IsonasUsers {
param
(
[Parameter(Position = 1)]
[switch]$All,
[Parameter(Mandatory = $false,
Position = 2)]
[ValidateNotNullOrEmpty()]
[int]$Limit = 200,
[Parameter(Position = 3)]
[bool]$IncludeDisabled = $false
)
$API_Users = $env:ISONAS_API_URL + "users"
if ($All)
{
Write-Host "All users was used"
$TargetUrl = "$API_Users/"
}
else
{
Write-Host "All users was NOT used"
$TargetUrl = "$API_Users/?includeDisabled=$IncludeDisabled&limit=$Limit"
}
$Response = Invoke-RestMethod -Uri $TargetUrl -Headers $(Get-IsonasRequestHeaders) -Method GET
$flattened = $response | ForEach-Object {
$obj = [PSCustomObject]@{
Id = $_.Id
CreatedTime = $_.createdTime
UpdatedTime = $_.updatedTime
FirstName = $_.firstName
LastName = $_.lastName
AreaID = $_.areaId
EmployeeId = $_.employeeId
IsDisabled = $_.isDisabled
}
foreach ($field in $_.userDefinedFields)
{
$propertyName = $field.name -replace '\s', ''
$obj | Add-Member -MemberType NoteProperty -Name $propertyName -Value $field.value
}
$obj
}
return $flattened
}

16
PSIsonas.psproj Normal file
View File

@ -0,0 +1,16 @@
<Project Synchronized="False" SyncFilter="*.ps1;*.psm1;*.psd1;*.ps1xml;*.psf;*.pss;*.xml;*.help.txt" AutoExportFunctions="True" ExportToLocalMachine="False" AutoExportPS1XMLFiles="True" StagingFolderName="bin">
<Version>2.1</Version>
<FileID>1fd60578-734d-4e9e-8c94-8f45bd4b92aa</FileID>
<ProjectType>1</ProjectType>
<RememberPowerShellVersion>True</RememberPowerShellVersion>
<PowerShellVersion>Local Machine - PowerShell V5 (64 Bit)</PowerShellVersion>
<Folders />
<Files>
<File Build="2">PSIsonas.psd1</File>
<File Build="0" Shared="True" ExportFunctions="True">PSIsonas.psm1</File>
<File Build="1" Shared="False" ReferenceFunction="Invoke-Test-Module_ps1" ExportFunctions="False">Test-Module.ps1</File>
<File Build="1">.gitignore</File>
<File Build="2">README.md</File>
</Files>
<StartupScript>Test-Module.ps1</StartupScript>
</Project>

BIN
PSIsonas.psproj.psbuild Normal file

Binary file not shown.

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# PSIsonas
--Overview high level of the program.--
## Description
--Description of the program.--
## Getting Started
--Information about getting the program setup.--
## Help
--Additional information need to use the software.--
## Authors
Alexis Lazcano
## Version History
2.1
## License
--Software license information.--
## Acknowledgments
--Place any acknowledgments here.--

138
bin/PSIsonas.psd1 Normal file
View File

@ -0,0 +1,138 @@
<#
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2024 v5.8.251
Created on: 12/17/2024 10:35 AM
Created by: Alexis Lazcano
Organization: Saratoga Corporate Management Group, LLC
Filename: PSIsonas.psd1
-------------------------------------------------------------------------
Module Manifest
-------------------------------------------------------------------------
Module Name: PSIsonas
===========================================================================
#>
@{
# Script module or binary module file associated with this manifest
RootModule = 'PSIsonas.psm1'
# Version number of this module.
ModuleVersion = '1.0.0.0'
# ID used to uniquely identify this module
GUID = '1fd60578-734d-4e9e-8c94-8f45bd4b92aa'
# Author of this module
Author = 'Alexis Lazcano'
# Company or vendor of this module
CompanyName = 'Saratoga Corporate Management Group, LLC'
# Copyright statement for this module
Copyright = '(c) 2024. All rights reserved.'
# Description of the functionality provided by this module
Description = 'Powershell wrapper for Isonas Pure Access Cloud.'
# Supported PSEditions
# CompatiblePSEditions = @('Core', 'Desktop')
# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '5.1'
# Name of the Windows PowerShell host required by this module
PowerShellHostName = ''
# Minimum version of the Windows PowerShell host required by this module
PowerShellHostVersion = ''
# Minimum version of the .NET Framework required by this module
DotNetFrameworkVersion = '4.5.2'
# Minimum version of the common language runtime (CLR) required by this module
# CLRVersion = ''
# Processor architecture (None, X86, Amd64, IA64) required by this module
ProcessorArchitecture = 'None'
# Modules that must be imported into the global environment prior to importing
# this module
RequiredModules = @()
# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
# Script files (.ps1) that are run in the caller's environment prior to
# importing this module
ScriptsToProcess = @()
# Type files (.ps1xml) to be loaded when importing this module
TypesToProcess = @()
# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @()
# Modules to import as nested modules of the module specified in
# ModuleToProcess
NestedModules = @()
# Functions to export from this module
FunctionsToExport = @(
'Get-IsonasRequestHeaders',
'Test-IsonasConnection',
'Get-IsonasUsers'
) #For performance, list functions explicitly
# Cmdlets to export from this module
CmdletsToExport = '*'
# Variables to export from this module
VariablesToExport = '*'
# Aliases to export from this module
AliasesToExport = '*' #For performance, list alias explicitly
# DSC class resources to export from this module.
#DSCResourcesToExport = ''
# List of all modules packaged with this module
ModuleList = @()
# List of all files packaged with this module
FileList = @()
# Private data to pass to the module specified in ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{
#Support for PowerShellGet galleries.
PSData = @{
# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()
# A URL to the license for this module.
# LicenseUri = ''
# A URL to the main website for this project.
# ProjectUri = ''
# A URL to an icon representing this module.
# IconUri = ''
# ReleaseNotes of this module
# ReleaseNotes = ''
} # End of PSData hashtable
} # End of PrivateData hashtable
}

BIN
bin/PSIsonas.psm1 Normal file

Binary file not shown.

16
bin/README.md Normal file
View File

@ -0,0 +1,16 @@
# PSIsonas
--Overview high level of the program.--
## Description
--Description of the program.--
## Getting Started
--Information about getting the program setup.--
## Help
--Additional information need to use the software.--
## Authors
Alexis Lazcano
## Version History
2.1
## License
--Software license information.--
## Acknowledgments
--Place any acknowledgments here.--