<commit_before>package denominator.dynect;

import com.google.gson.JsonElement;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Named;

import denominator.model.ResourceRecordSet;
import denominator.model.Zone;
import feign.Body;
import feign.RequestLine;

public interface DynECT {

  @RequestLine("GET /Zone")
  Data<List<Zone>> zones();

  @RequestLine("PUT /Zone/{zone}")
  @Body("{\"publish\":true}")
  void publish(@Named("zone") String zone);

  @RequestLine("GET /AllRecord/{zone}?detail=Y")
  Data<Iterator<ResourceRecordSet<?>>> rrsets(@Named("zone") String zone);

  @RequestLine("POST /CheckPermissionReport")
  @Body("{\"permission\":[\"GeoUpdate\",\"GeoDelete\",\"GeoGet\",\"GeoActivate\",\"GeoDeactivate\"]}")
  Data<Boolean> hasAllGeoPermissions();

  @RequestLine("GET /Geo?detail=Y")
  Data<List<GeoService>> geoServices();

  @RequestLine("GET /AllRecord/{zone}/{fqdn}?detail=Y")
  Data<Iterator<ResourceRecordSet<?>>> rrsetsInZoneByName(@Named("zone") String zone,
                                                          @Named("fqdn") String fqdn);

  @RequestLine("GET /{type}Record/{zone}/{fqdn}?detail=Y")
  Data<Iterator<ResourceRecordSet<?>>> rrsetsInZoneByNameAndType(@Named("zone") String zone,
                                                                 @Named("fqdn") String fqdn,
                                                                 @Named("type") String type);

  @RequestLine("GET /{type}Record/{zone}/{fqdn}")
  Data<List<String>> recordIdsInZoneByNameAndType(@Named("zone") String zone,
                                                  @Named("fqdn") String fqdn,
                                                  @Named("type") String type);

  @RequestLine("GET /{type}Record/{zone}/{fqdn}?detail=Y")
  Data<Iterator<Record>> recordsInZoneByNameAndType(@Named("zone") String zone,
                                                    @Named("fqdn") String fqdn,
                                                    @Named("type") String type);

  @RequestLine("POST /{type}Record/{zone}/{fqdn}")
  void scheduleCreateRecord(@Named("zone") String zone, @Named("fqdn") String fqdn,
                            @Named("type") String type,
                            @Named("ttl") int ttl, @Named("rdata") Map<String, Object> rdata);

  @RequestLine("DELETE /{recordId}")
  void scheduleDeleteRecord(@Named("recordId") String recordId);

  /**
   * DynECT json includes an envelope called "data", which makes it difficult.
   */
  static class Data<T> {

    T data;
  }

  static class Record {

    long id;
    String name;
    String type;
    int ttl;
    Map<String, Object> rdata = new LinkedHashMap<String, Object>();
  }

  static class GeoService {

    List<Node> nodes = new ArrayList<Node>();
    List<GeoRegionGroup> groups = new ArrayList<GeoRegionGroup>();

    static class Node {<commit_msg>Completes DynECT port to Feign 7<commit_after>package denominator.dynect;

import com.google.gson.JsonElement;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import denominator.model.ResourceRecordSet;
import denominator.model.Zone;
import feign.Body;
import feign.Param;
import feign.RequestLine;

public interface DynECT {

  @RequestLine("GET /Zone")
  Data<List<Zone>> zones();

  @RequestLine("PUT /Zone/{zone}")
  @Body("{\"publish\":true}")
  void publish(@Param("zone") String zone);

  @RequestLine("GET /AllRecord/{zone}?detail=Y")
  Data<Iterator<ResourceRecordSet<?>>> rrsets(@Param("zone") String zone);

  @RequestLine("POST /CheckPermissionReport")
  @Body("{\"permission\":[\"GeoUpdate\",\"GeoDelete\",\"GeoGet\",\"GeoActivate\",\"GeoDeactivate\"]}")
  Data<Boolean> hasAllGeoPermissions();

  @RequestLine("GET /Geo?detail=Y")
  Data<List<GeoService>> geoServices();

  @RequestLine("GET /AllRecord/{zone}/{fqdn}?detail=Y")
  Data<Iterator<ResourceRecordSet<?>>> rrsetsInZoneByName(@Param("zone") String zone,
                                                          @Param("fqdn") String fqdn);

  @RequestLine("GET /{type}Record/{zone}/{fqdn}?detail=Y")
  Data<Iterator<ResourceRecordSet<?>>> rrsetsInZoneByNameAndType(@Param("zone") String zone,
                                                                 @Param("fqdn") String fqdn,
                                                                 @Param("type") String type);

  @RequestLine("GET /{type}Record/{zone}/{fqdn}")
  Data<List<String>> recordIdsInZoneByNameAndType(@Param("zone") String zone,
                                                  @Param("fqdn") String fqdn,
                                                  @Param("type") String type);

  @RequestLine("GET /{type}Record/{zone}/{fqdn}?detail=Y")
  Data<Iterator<Record>> recordsInZoneByNameAndType(@Param("zone") String zone,
                                                    @Param("fqdn") String fqdn,
                                                    @Param("type") String type);

  @RequestLine("POST /{type}Record/{zone}/{fqdn}")
  void scheduleCreateRecord(@Param("zone") String zone, @Param("fqdn") String fqdn,
                            @Param("type") String type,
                            @Param("ttl") int ttl, @Param("rdata") Map<String, Object> rdata);

  @RequestLine("DELETE /{recordId}")
  void scheduleDeleteRecord(@Param("recordId") String recordId);

  /**
   * DynECT json includes an envelope called "data", which makes it difficult.
   */
  static class Data<T> {

    T data;
  }

  static class Record {

    long id;
    String name;
    String type;
    int ttl;
    Map<String, Object> rdata = new LinkedHashMap<String, Object>();
  }

  static class GeoService {

    List<Node> nodes = new ArrayList<Node>();
    List<GeoRegionGroup> groups = new ArrayList<GeoRegionGroup>();

    static class Node {
{'fraction_non_alphanumeric': 0.14785534062237174, 'fraction_numerical': 0.0001682085786375105, 'mean_word_length': 2.63003663003663, 'pattern_counts': {'":': 4, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6641341', 'n_tokens_mistral': 1706, 'n_tokens_neox': 1671, 'n_words': 345}