rimashah25 commented on code in PR #7362:
URL: https://github.com/apache/trafficcontrol/pull/7362#discussion_r1124818356


##########
experimental/traffic-portal/src/app/api/testing/cache-group.service.ts:
##########
@@ -584,4 +593,39 @@ export class CacheGroupService {
                }
                return this.regions.splice(index, 1)[0];
        }
+
+       public async getASNs(): Promise<Array<ResponseASN>>;
+       public async getASNs(id: number): Promise<ResponseASN>;
+
+       /**
+        * Gets an array of ASNs from Traffic Ops.
+        *
+        * @param id If given, returns only the asn with the given id (number).
+        * @returns An Array of ASNs objects - or a single ASN object if 'id'
+        * was given.
+        */
+       public async getASNs(id?: number): Promise<Array<ResponseASN> | 
ResponseASN> {
+               if(id) {
+                       const asn = this.asns.find(a=>a.id === id);
+                       if (!asn) {
+                               throw new Error(`no such asn with id: ${id}`);
+                       }
+                       return asn;
+               }
+               return this.asns;
+       }
+
+       /**
+        * Deletes an existing asn.
+        *
+        * @param asn Id of the asn to delete.
+        * @returns The deleted asn.
+        */
+       public async deleteASN(asn: number): Promise<ResponseASN> {

Review Comment:
   Ok, I was looking at region as an example and I think it is missing there 
too. I added it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to