@@ -41,24 +41,21 @@ impl BicepExtension for BicepExtensionService {
4141 return Err ( Status :: invalid_argument ( "Resource not found" ) ) ;
4242 } ;
4343
44- let _result = match resource. set ( & properties, false , & ExecutionKind :: Actual ) {
45- Ok ( res) => res,
46- Err ( e) => return Err ( Status :: internal ( format ! ( "DSC set operation failed: {e}" ) ) ) ,
44+ let result = match resource. set ( & properties, false , & ExecutionKind :: Actual ) {
45+ Ok ( r) => LocalExtensibilityOperationResponse {
46+ resource : Some ( proto:: Resource {
47+ r#type : resource_type,
48+ api_version : version,
49+ identifiers : String :: new ( ) ,
50+ properties : serde_json:: to_string ( & r) . unwrap ( ) ,
51+ status : None ,
52+ } ) ,
53+ error_data : None ,
54+ } ,
55+ Err ( e) => return Err ( Status :: internal ( format ! ( "DSC set operation failed: {e}" ) ) )
4756 } ;
4857
49- // TODO: Use '_result'.
50- let response = LocalExtensibilityOperationResponse {
51- resource : Some ( proto:: Resource {
52- r#type : resource_type,
53- api_version : version,
54- identifiers : String :: new ( ) ,
55- properties : properties,
56- status : None ,
57- } ) ,
58- error_data : None ,
59- } ;
60-
61- Ok ( Response :: new ( response) )
58+ Ok ( Response :: new ( result) )
6259 }
6360
6461 async fn preview (
@@ -77,28 +74,21 @@ impl BicepExtension for BicepExtensionService {
7774 return Err ( Status :: invalid_argument ( "Resource not found" ) ) ;
7875 } ;
7976
80- let _result = match resource. set ( & properties, false , & ExecutionKind :: WhatIf ) {
81- Ok ( res) => res,
82- Err ( e) => {
83- return Err ( Status :: internal ( format ! (
84- "DSC whatif operation failed: {e}"
85- ) ) )
86- }
87- } ;
88-
89- // TODO: Use '_result'.
90- let response = LocalExtensibilityOperationResponse {
91- resource : Some ( proto:: Resource {
92- r#type : resource_type,
93- api_version : version,
94- identifiers : String :: new ( ) ,
95- properties : properties,
96- status : None ,
97- } ) ,
98- error_data : None ,
77+ let result = match resource. set ( & properties, false , & ExecutionKind :: WhatIf ) {
78+ Ok ( r) => LocalExtensibilityOperationResponse {
79+ resource : Some ( proto:: Resource {
80+ r#type : resource_type,
81+ api_version : version,
82+ identifiers : String :: new ( ) ,
83+ properties : serde_json:: to_string ( & r) . unwrap ( ) ,
84+ status : None ,
85+ } ) ,
86+ error_data : None ,
87+ } ,
88+ Err ( e) => return Err ( Status :: internal ( format ! ( "DSC whatif operation failed: {e}" ) ) )
9989 } ;
10090
101- Ok ( Response :: new ( response ) )
91+ Ok ( Response :: new ( result ) )
10292 }
10393
10494 async fn get (
@@ -118,24 +108,21 @@ impl BicepExtension for BicepExtensionService {
118108 } ;
119109
120110 // TODO: DSC asks for 'properties' here but we only have 'identifiers' from Bicep.
121- let _result = match resource. get ( & identifiers) {
122- Ok ( res) => res,
123- Err ( e) => return Err ( Status :: internal ( format ! ( "DSC get operation failed: {e}" ) ) ) ,
111+ let result = match resource. get ( & identifiers) {
112+ Ok ( r) => LocalExtensibilityOperationResponse {
113+ resource : Some ( proto:: Resource {
114+ r#type : resource_type,
115+ api_version : version,
116+ identifiers : String :: new ( ) ,
117+ properties : serde_json:: to_string ( & r) . unwrap ( ) ,
118+ status : None ,
119+ } ) ,
120+ error_data : None ,
121+ } ,
122+ Err ( e) => return Err ( Status :: internal ( format ! ( "DSC get operation failed: {e}" ) ) )
124123 } ;
125124
126- // TODO: Use '_result'.
127- let response = LocalExtensibilityOperationResponse {
128- resource : Some ( proto:: Resource {
129- r#type : resource_type,
130- api_version : version,
131- identifiers : identifiers,
132- properties : String :: new ( ) ,
133- status : None ,
134- } ) ,
135- error_data : None ,
136- } ;
137-
138- Ok ( Response :: new ( response) )
125+ Ok ( Response :: new ( result) )
139126 }
140127
141128 async fn delete (
@@ -160,28 +147,21 @@ impl BicepExtension for BicepExtensionService {
160147 } ;
161148
162149 // TODO: DSC asks for 'properties' here but we only have 'identifiers' from Bicep.
163- let _result = match resource. delete ( & identifiers) {
164- Ok ( res) => res,
165- Err ( e) => {
166- return Err ( Status :: internal ( format ! (
167- "DSC delete operation failed: {e}"
168- ) ) )
169- }
170- } ;
171-
172- // TODO: Use '_result'.
173- let response = LocalExtensibilityOperationResponse {
174- resource : Some ( proto:: Resource {
175- r#type : resource_type,
176- api_version : version,
177- identifiers : identifiers,
178- properties : String :: new ( ) ,
179- status : None ,
180- } ) ,
181- error_data : None ,
150+ let result = match resource. delete ( & identifiers) {
151+ Ok ( r) => LocalExtensibilityOperationResponse {
152+ resource : Some ( proto:: Resource {
153+ r#type : resource_type,
154+ api_version : version,
155+ identifiers : String :: new ( ) ,
156+ properties : serde_json:: to_string ( & r) . unwrap ( ) ,
157+ status : None ,
158+ } ) ,
159+ error_data : None ,
160+ } ,
161+ Err ( e) => return Err ( Status :: internal ( format ! ( "DSC delete operation failed: {e}" ) ) )
182162 } ;
183163
184- Ok ( Response :: new ( response ) )
164+ Ok ( Response :: new ( result ) )
185165 }
186166
187167 async fn get_type_files (
0 commit comments