export type BGPPolicyDefinitionsStatement = {name?: string | undefined, conditions?: ({bgpConditions?: ({afiSafiIn?: Array | undefined, asPathLength?: ({operator?: string | undefined, value?: number | undefined}) | undefined, matchAsPathSet?: ({asPathSet?: string | undefined, matchSetOptions?: string | undefined}) | undefined, matchCommunitySet?: ({communitySet?: string | undefined, matchSetOptions?: string | undefined}) | undefined, matchExtCommunitySet?: ({communitySet?: string | undefined, matchSetOptions?: string | undefined}) | undefined, matchLargeCommunitySet?: ({communitySet?: string | undefined, matchSetOptions?: string | undefined}) | undefined, nextHopInList?: Array | undefined, rpki?: string | undefined, routeType?: string | undefined}) | undefined, matchNeighborSet?: ({matchSetOption?: string | undefined, neighborSet?: string | undefined}) | undefined, matchPrefixSet?: ({matchSetOption?: string | undefined, prefixSet?: string | undefined}) | undefined}) | undefined, actions?: ({routeDisposition?: string | undefined, bgpActions?: ({setMed?: string | undefined, setNextHop?: string | undefined, setLocalPerf?: number | undefined, setCommunity?: ({options?: string | undefined, setCommunityMethod?: Array | undefined}) | undefined, setExtCommunity?: ({options?: string | undefined, setCommunityMethod?: Array | undefined}) | undefined, setLargeCommunity?: ({options?: string | undefined, setCommunityMethod?: Array | undefined}) | undefined, setAsPathPrepend?: ({as?: string | undefined, repeatN?: number | undefined}) | undefined}) | undefined}) | undefined}; export type BGPPolicyDefinitionsMod = {name?: string | undefined, statements?: Array | undefined}; export type CreateApiConfigBgpPolicyDefinitionsArgs = {body: BGPPolicyDefinitionsMod}; export type CreateApiConfigBgpPolicyDefinitionsOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Adds a BGP Policy * * POST /config/bgp/policy/definitions */ export const createApiConfigBgpPolicyDefinitions = async (args: CreateApiConfigBgpPolicyDefinitionsArgs, options?: CreateApiConfigBgpPolicyDefinitionsOptions) => { const {baseUrl = "http://0.0.0.0:11111/netlox/v1", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set("Authorization", BearerAuth) const url = `${baseUrl.replace(/\/+$/, '')}/config/bgp/policy/definitions${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };