Skip to content

Commit 6191b04

Browse files
Initial
1 parent dbd2fa8 commit 6191b04

2 files changed

Lines changed: 135 additions & 0 deletions

File tree

src/dsc/psresourceget.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[CmdletBinding()]
2+
param(
3+
[Parameter(Mandatory = $true)]
4+
[ValidateSet('repository', 'psresource', 'repositories', 'psresources')]
5+
[string]$ResourceType,
6+
[Parameter(Mandatory = $true)]
7+
[ValidateSet('Get', 'Set', 'Export', 'Test')]
8+
[string]$Operation,
9+
[Parameter(ValueFromPipeline)]
10+
$stdinput
11+
)
12+
13+
# catch any un-caught exception and write it to the error stream
14+
trap {
15+
Write-Trace -Level Error -message $_.Exception.Message
16+
exit 1
17+
}
18+
19+
function Write-Trace {
20+
param(
21+
[string]$message,
22+
[string]$level = 'Error'
23+
)
24+
25+
$trace = [pscustomobject]@{
26+
$level.ToLower() = $message
27+
} | ConvertTo-Json -Compress
28+
29+
$host.ui.WriteErrorLine($trace)
30+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/bundled/resource/manifest.json",
3+
"type": "Microsoft.PowerShell.Debug/Echo",
4+
"version": "0.0.1",
5+
"get": {
6+
"executable": "pwsh",
7+
"args": [
8+
"-NoLogo",
9+
"-NonInteractive",
10+
"-NoProfile",
11+
"-Command",
12+
"./psresourceget.ps1 -resourcetype 'repository' -operation get"
13+
],
14+
"input": "stdin"
15+
},
16+
"set": {
17+
"executable": "pwsh",
18+
"args": [
19+
"-NoLogo",
20+
"-NonInteractive",
21+
"-NoProfile",
22+
"-Command",
23+
"./psresourceget.ps1 -resourcetype 'repository' -operation set"
24+
],
25+
"input": "stdin"
26+
},
27+
"export": {
28+
"executable": "pwsh",
29+
"args": [
30+
"-NoLogo",
31+
"-NonInteractive",
32+
"-NoProfile",
33+
"-Command",
34+
"./psresourceget.ps1 -resourcetype 'repository' -operation export"
35+
],
36+
"input": "stdin"
37+
},
38+
"test": {
39+
"executable": "pwsh",
40+
"args": [
41+
"-NoLogo",
42+
"-NonInteractive",
43+
"-NoProfile",
44+
"-Command",
45+
"./psresourceget.ps1 -resourcetype 'repository' -operation test"
46+
],
47+
"input": "stdin"
48+
},
49+
"schema": {
50+
"embedded": {
51+
"$schema": "http://json-schema.org/draft-04/schema#",
52+
"title": "Repository",
53+
"type": "object",
54+
"additionalProperties": false,
55+
"properties": {
56+
"name": {
57+
"type": [
58+
"null",
59+
"string"
60+
]
61+
},
62+
"uri": {
63+
"type": [
64+
"null",
65+
"string"
66+
]
67+
},
68+
"trusted": {
69+
"type": "boolean"
70+
},
71+
"priority": {
72+
"type": "integer"
73+
},
74+
"repositoryType": {
75+
"$ref": "#/definitions/RepositoryType"
76+
},
77+
"_exists": {
78+
"type": "boolean"
79+
}
80+
},
81+
"definitions": {
82+
"RepositoryType": {
83+
"type": "integer",
84+
"description": "",
85+
"x-enumNames": [
86+
"Unknown",
87+
"V2",
88+
"V3",
89+
"Local",
90+
"NugetServer",
91+
"ContainerRegistry"
92+
],
93+
"enum": [
94+
0,
95+
1,
96+
2,
97+
3,
98+
4,
99+
5
100+
]
101+
}
102+
}
103+
}
104+
}
105+
}

0 commit comments

Comments
 (0)