@@ -21,6 +21,7 @@ import { ApplicationSecurityPolicyCreateRequest } from "../models/ApplicationSec
2121import { ApplicationSecurityPolicyListResponse } from "../models/ApplicationSecurityPolicyListResponse" ;
2222import { ApplicationSecurityPolicyResponse } from "../models/ApplicationSecurityPolicyResponse" ;
2323import { ApplicationSecurityPolicyUpdateRequest } from "../models/ApplicationSecurityPolicyUpdateRequest" ;
24+ import { ApplicationSecurityServicesResponse } from "../models/ApplicationSecurityServicesResponse" ;
2425import { ApplicationSecurityWafCustomRuleCreateRequest } from "../models/ApplicationSecurityWafCustomRuleCreateRequest" ;
2526import { ApplicationSecurityWafCustomRuleListResponse } from "../models/ApplicationSecurityWafCustomRuleListResponse" ;
2627import { ApplicationSecurityWafCustomRuleResponse } from "../models/ApplicationSecurityWafCustomRuleResponse" ;
@@ -398,6 +399,45 @@ export class ApplicationSecurityApiRequestFactory extends BaseAPIRequestFactory
398399 return requestContext ;
399400 }
400401
402+ public async getAsmServiceByName (
403+ serviceFilter : string ,
404+ _options ?: Configuration
405+ ) : Promise < RequestContext > {
406+ const _config = _options || this . configuration ;
407+
408+ logger . warn ( "Using unstable operation 'getAsmServiceByName'" ) ;
409+ if ( ! _config . unstableOperations [ "v2.getAsmServiceByName" ] ) {
410+ throw new Error ( "Unstable operation 'getAsmServiceByName' is disabled" ) ;
411+ }
412+
413+ // verify required parameter 'serviceFilter' is not null or undefined
414+ if ( serviceFilter === null || serviceFilter === undefined ) {
415+ throw new RequiredError ( "serviceFilter" , "getAsmServiceByName" ) ;
416+ }
417+
418+ // Path Params
419+ const localVarPath =
420+ "/api/v2/security/asm/services/{service_filter}" . replace (
421+ "{service_filter}" ,
422+ encodeURIComponent ( String ( serviceFilter ) )
423+ ) ;
424+
425+ // Make Request Context
426+ const requestContext = _config
427+ . getServer ( "v2.ApplicationSecurityApi.getAsmServiceByName" )
428+ . makeRequestContext ( localVarPath , HttpMethod . GET ) ;
429+ requestContext . setHeaderParam ( "Accept" , "application/json" ) ;
430+ requestContext . setHttpConfig ( _config . httpConfig ) ;
431+
432+ // Apply auth methods
433+ applySecurityAuthentication ( _config , requestContext , [
434+ "apiKeyAuth" ,
435+ "appKeyAuth" ,
436+ ] ) ;
437+
438+ return requestContext ;
439+ }
440+
401441 public async listApplicationSecurityWAFCustomRules (
402442 _options ?: Configuration
403443 ) : Promise < RequestContext > {
@@ -1196,6 +1236,66 @@ export class ApplicationSecurityApiResponseProcessor {
11961236 ) ;
11971237 }
11981238
1239+ /**
1240+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
1241+ * to the expected objects
1242+ *
1243+ * @params response Response returned by the server for a request to getAsmServiceByName
1244+ * @throws ApiException if the response code was not in [200, 299]
1245+ */
1246+ public async getAsmServiceByName (
1247+ response : ResponseContext
1248+ ) : Promise < ApplicationSecurityServicesResponse > {
1249+ const contentType = ObjectSerializer . normalizeMediaType (
1250+ response . headers [ "content-type" ]
1251+ ) ;
1252+ if ( response . httpStatusCode === 200 ) {
1253+ const body : ApplicationSecurityServicesResponse =
1254+ ObjectSerializer . deserialize (
1255+ ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
1256+ "ApplicationSecurityServicesResponse"
1257+ ) as ApplicationSecurityServicesResponse ;
1258+ return body ;
1259+ }
1260+ if ( response . httpStatusCode === 403 || response . httpStatusCode === 429 ) {
1261+ const bodyText = ObjectSerializer . parse (
1262+ await response . body . text ( ) ,
1263+ contentType
1264+ ) ;
1265+ let body : APIErrorResponse ;
1266+ try {
1267+ body = ObjectSerializer . deserialize (
1268+ bodyText ,
1269+ "APIErrorResponse"
1270+ ) as APIErrorResponse ;
1271+ } catch ( error ) {
1272+ logger . debug ( `Got error deserializing error: ${ error } ` ) ;
1273+ throw new ApiException < APIErrorResponse > (
1274+ response . httpStatusCode ,
1275+ bodyText
1276+ ) ;
1277+ }
1278+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
1279+ }
1280+
1281+ // Work around for missing responses in specification, e.g. for petstore.yaml
1282+ if ( response . httpStatusCode >= 200 && response . httpStatusCode <= 299 ) {
1283+ const body : ApplicationSecurityServicesResponse =
1284+ ObjectSerializer . deserialize (
1285+ ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
1286+ "ApplicationSecurityServicesResponse" ,
1287+ ""
1288+ ) as ApplicationSecurityServicesResponse ;
1289+ return body ;
1290+ }
1291+
1292+ const body = ( await response . body . text ( ) ) || "" ;
1293+ throw new ApiException < string > (
1294+ response . httpStatusCode ,
1295+ 'Unknown API Status Code!\nBody: "' + body + '"'
1296+ ) ;
1297+ }
1298+
11991299 /**
12001300 * Unwraps the actual response sent by the server from the response context and deserializes the response content
12011301 * to the expected objects
@@ -1647,6 +1747,15 @@ export interface ApplicationSecurityApiGetApplicationSecurityWafPolicyRequest {
16471747 policyId : string ;
16481748}
16491749
1750+ export interface ApplicationSecurityApiGetAsmServiceByNameRequest {
1751+ /**
1752+ * The name of the service to retrieve Application Security details for.
1753+ * Returns all matching services across environments.
1754+ * @type string
1755+ */
1756+ serviceFilter : string ;
1757+ }
1758+
16501759export interface ApplicationSecurityApiUpdateApplicationSecurityWafCustomRuleRequest {
16511760 /**
16521761 * The ID of the custom rule.
@@ -1922,6 +2031,30 @@ export class ApplicationSecurityApi {
19222031 } ) ;
19232032 }
19242033
2034+ /**
2035+ * Retrieve Application Security details for services matching the given name.
2036+ * Returns Application Security activation, compatibility, and product enablement
2037+ * information for each matching `(service, environment)` pair, along with a count
2038+ * of services that have Application Security Management (Threats) enabled.
2039+ * @param param The request object
2040+ */
2041+ public getAsmServiceByName (
2042+ param : ApplicationSecurityApiGetAsmServiceByNameRequest ,
2043+ options ?: Configuration
2044+ ) : Promise < ApplicationSecurityServicesResponse > {
2045+ const requestContextPromise = this . requestFactory . getAsmServiceByName (
2046+ param . serviceFilter ,
2047+ options
2048+ ) ;
2049+ return requestContextPromise . then ( ( requestContext ) => {
2050+ return this . configuration . httpApi
2051+ . send ( requestContext )
2052+ . then ( ( responseContext ) => {
2053+ return this . responseProcessor . getAsmServiceByName ( responseContext ) ;
2054+ } ) ;
2055+ } ) ;
2056+ }
2057+
19252058 /**
19262059 * Retrieve a list of WAF custom rule.
19272060 * @param param The request object
0 commit comments