def METHOD_NAME():
    """
    Cloud Custodian Admission Controller
    """
    parser = _parser()
    args = parser.parse_args()
    if args.generate:
        directory_loader = DirectoryLoader(Config.empty())
        policy_collection = directory_loader.load_directory(os.path.abspath(args.policy_dir))
        operations = []
        groups = []
        api_versions = []
        resources = []
        for p in policy_collection:
            execution_mode = p.get_execution_mode()
            # We only support `k8s-admission` policies for the admission
            # controller.
            if execution_mode.type != "k8s-admission":
                policy = execution_mode.policy
                type_ = execution_mode.type
                log.warning(
                    f"skipping policy {policy.name} with type {type_}, should be k8s-admission"
                )
                continue
            mvals = p.get_execution_mode().get_match_values()
            operations.extend(mvals["operations"])
            groups.append(mvals["group"])
            api_versions.append(mvals["apiVersions"])
            resources.extend(mvals["resources"])
        TEMPLATE["webhooks"][0]["rules"][0]["operations"] = sorted(list(set(operations)))
        TEMPLATE["webhooks"][0]["rules"][0]["apiGroups"] = sorted(list(set(groups)))
        TEMPLATE["webhooks"][0]["rules"][0]["apiVersions"] = sorted(list(set(api_versions)))
        TEMPLATE["webhooks"][0]["rules"][0]["resources"] = sorted(list(set(resources)))
        if args.endpoint:
            TEMPLATE["webhooks"][0]["clientConfig"]["url"] = args.endpoint
        print(yaml.dump(TEMPLATE))
    else:
        init(
            args.host,
            args.port,
            args.policy_dir,
            args.on_exception,
            cert_path=args.cert,
            cert_key_path=args.cert_key,
            ca_cert_path=args.ca_cert,
        )