@@ -43,12 +43,12 @@ impl BicepExtension for BicepExtensionService {
4343
4444 let mut dsc = DscManager :: new ( ) ;
4545 let Some ( resource) = dsc. find_resource ( & resource_type, version. as_deref ( ) ) else {
46- return Err ( Status :: invalid_argument ( "Resource not found" ) ) ;
46+ return Err ( Status :: not_found ( "Resource not found" ) ) ;
4747 } ;
4848
4949 let SetResult :: Resource ( result) = resource
5050 . set ( & properties, false , & ExecutionKind :: Actual )
51- . map_err ( |e| Status :: internal ( format ! ( "DSC set operation failed: {e}" ) ) ) ?
51+ . map_err ( |e| Status :: aborted ( e . to_string ( ) ) ) ?
5252 else {
5353 return Err ( Status :: unimplemented ( "Group resources not supported" ) ) ;
5454 } ;
@@ -78,12 +78,12 @@ impl BicepExtension for BicepExtensionService {
7878
7979 let mut dsc = DscManager :: new ( ) ;
8080 let Some ( resource) = dsc. find_resource ( & resource_type, version. as_deref ( ) ) else {
81- return Err ( Status :: invalid_argument ( "Resource not found" ) ) ;
81+ return Err ( Status :: not_found ( "Resource not found" ) ) ;
8282 } ;
8383
8484 let SetResult :: Resource ( result) = resource
8585 . set ( & properties, false , & ExecutionKind :: WhatIf )
86- . map_err ( |e| Status :: internal ( format ! ( "DSC whatif operation failed: {e}" ) ) ) ?
86+ . map_err ( |e| Status :: aborted ( e . to_string ( ) ) ) ?
8787 else {
8888 return Err ( Status :: unimplemented ( "Group resources not supported" ) ) ;
8989 } ;
@@ -113,13 +113,13 @@ impl BicepExtension for BicepExtensionService {
113113
114114 let mut dsc = DscManager :: new ( ) ;
115115 let Some ( resource) = dsc. find_resource ( & resource_type, version. as_deref ( ) ) else {
116- return Err ( Status :: invalid_argument ( "Resource not found" ) ) ;
116+ return Err ( Status :: not_found ( "Resource not found" ) ) ;
117117 } ;
118118
119119 // TODO: DSC asks for 'properties' here but we only have 'identifiers' from Bicep.
120120 let GetResult :: Resource ( result) = resource
121121 . get ( & identifiers)
122- . map_err ( |e| Status :: internal ( format ! ( "DSC get operation failed: {e}" ) ) ) ?
122+ . map_err ( |e| Status :: aborted ( e . to_string ( ) ) ) ?
123123 else {
124124 return Err ( Status :: unimplemented ( "Group resources not supported" ) ) ;
125125 } ;
@@ -154,26 +154,20 @@ impl BicepExtension for BicepExtensionService {
154154
155155 let mut dsc = DscManager :: new ( ) ;
156156 let Some ( resource) = dsc. find_resource ( & resource_type, version. as_deref ( ) ) else {
157- return Err ( Status :: invalid_argument ( "Resource not found" ) ) ;
157+ return Err ( Status :: not_found ( "Resource not found" ) ) ;
158158 } ;
159159
160160 // TODO: DSC asks for 'properties' here but we only have 'identifiers' from Bicep.
161- let result = match resource. delete ( & identifiers) {
162- // Successful deletion returns () so we return an empty JSON object.
163- Ok ( _) => "{}" . to_string ( ) ,
164- Err ( e) => {
165- return Err ( Status :: internal ( format ! (
166- "DSC delete operation failed: {e}"
167- ) ) )
168- }
169- } ;
161+ resource
162+ . delete ( & identifiers)
163+ . map_err ( |e| Status :: aborted ( e. to_string ( ) ) ) ?;
170164
171165 Ok ( Response :: new ( LocalExtensibilityOperationResponse {
172166 resource : Some ( proto:: Resource {
173167 r#type : resource_type,
174168 api_version : version,
175169 identifiers : identifiers,
176- properties : result ,
170+ properties : "{}" . to_string ( ) ,
177171 status : None ,
178172 } ) ,
179173 error_data : None ,
0 commit comments