File tree Expand file tree Collapse file tree 3 files changed +32
-18
lines changed
source/Public/SQL Database Expand file tree Collapse file tree 3 files changed +32
-18
lines changed Original file line number Diff line number Diff line change @@ -101,25 +101,26 @@ function Get-FabricSQLDatabase
101
101
{
102
102
$uri = " $uri /$SQLDatabaseId "
103
103
}
104
- $response = Invoke-FabricRestMethod - Uri $uri
105
104
106
- # Step: Validate the response code
107
- Test-FabricApiResponse - Response $response - ObjectIdOrName $SQLDatabaseId - TypeName " SQL Database"
105
+ # Make the API request and validate the response code
106
+ $apiParams = @ {
107
+ Uri = $uri
108
+ Method = ' GET'
109
+ TypeName = ' SQL Database'
110
+ ObjectIdOrName = $SQLDatabaseName
111
+ HandleResponse = $true
112
+ ExtractValue = ' True'
113
+ }
114
+
115
+ $response = Invoke-FabricRestMethod @apiParams
108
116
109
- $response = $response.value
110
117
if ($SQLDatabaseName )
111
118
{
112
119
# Filter the SQLDatabase by name
113
120
$response = $response | Where-Object { $_.displayName -eq $SQLDatabaseName }
114
121
}
115
- if ($response )
116
- {
117
- $return += $response
118
- }
122
+ $response
119
123
}
120
124
121
- End
122
- {
123
- $return
124
- }
125
+ End {}
125
126
}
Original file line number Diff line number Diff line change @@ -73,10 +73,17 @@ function New-FabricSQLDatabase
73
73
# Step 4: Make the API request
74
74
if ($PSCmdlet.ShouldProcess ($apiEndpointUrl , " Create SQL Database" ))
75
75
{
76
- $response = Invoke-FabricRestMethod - Uri $apiEndpointUrl - Method Post - Body $bodyJson
76
+ $apiParams = @ {
77
+ Uri = $apiEndpointUrl
78
+ Method = ' POST'
79
+ Body = $bodyJson
80
+ TypeName = ' SQL Database'
81
+ NoWait = $NoWait
82
+ HandleResponse = $true
83
+ }
84
+ $response = Invoke-FabricRestMethod @apiParams
85
+ $response
77
86
}
78
- # Step 5: Handle and log the response
79
- Test-FabricApiResponse - Response $response - ObjectIdOrName $Name - TypeName ' SQL Database' - NoWait:$NoWait
80
87
}
81
88
catch
82
89
{
Original file line number Diff line number Diff line change @@ -48,11 +48,17 @@ function Remove-FabricSQLDatabase
48
48
if ($PSCmdlet.ShouldProcess ($apiEndpointUrl , " Delete SQL Database" ))
49
49
{
50
50
# Step 3: Make the API request
51
- $response = Invoke-FabricRestMethod - Uri $apiEndpointUrl - Method Delete
51
+ $apiParams = @ {
52
+ Uri = $apiEndpointUrl
53
+ Method = ' DELETE'
54
+ TypeName = ' SQL Database'
55
+ ObjectIdOrName = $SQLDatabaseId
56
+ HandleResponse = $true
57
+ }
58
+ $response = Invoke-FabricRestMethod @apiParams
59
+ $response
52
60
}
53
61
54
- # Step 4: Validate the response code
55
- Test-FabricApiResponse - Response $response - ObjectIdOrName $SQLDatabaseId - TypeName " SQL Database"
56
62
}
57
63
catch
58
64
{
You can’t perform that action at this time.
0 commit comments