<commit_before>/**
 * Copyright (C) 2009-2014 Dell, Inc.
 * See annotations for authorship information
 *
 * ====================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ====================================================================
 */

package org.dasein.cloud.network;

import java.util.HashMap;
import java.util.Locale;

import org.dasein.cloud.AccessControlledService;
import org.dasein.cloud.CloudException;
import org.dasein.cloud.InternalException;
import org.dasein.cloud.OperationNotSupportedException;
import org.dasein.cloud.Requirement;
import org.dasein.cloud.ResourceStatus;
import org.dasein.cloud.identity.ServiceAction;

import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * Implements support for cloud load balancing services.
 * @author <NAME>
 * @author <NAME>
 * @version 2013.04 added Javadoc and did some refactoring
 * @version 2013.02 added support for health checks
 * @since unknown
 */
public interface LoadBalancerSupport extends AccessControlledService {
    static public final ServiceAction ANY                       = new ServiceAction("LB:ANY");

    static public final ServiceAction ADD_DATA_CENTERS          = new ServiceAction("LB:ADD_DC");
    static public final ServiceAction ADD_VMS                   = new ServiceAction("LB:ADD_VM");
    static public final ServiceAction CREATE_LOAD_BALANCER      = new ServiceAction("LB:CREATE_LOAD_BALANCER");
    static public final ServiceAction GET_LOAD_BALANCER         = new ServiceAction("LB:GET_LOAD_BALANCER");
    static public final ServiceAction LIST_LOAD_BALANCER        = new ServiceAction("LB:LIST_LOAD_BALANCER");
    static public final ServiceAction GET_LOAD_BALANCER_SERVER_HEALTH   = new ServiceAction("LB:GET_LOAD_BALANCER_SERVER_HEALTH");
    static public final ServiceAction REMOVE_DATA_CENTERS       = new ServiceAction("LB:REMOVE_DC");
    static public final ServiceAction REMOVE_VMS                = new ServiceAction("LB:REMOVE_VM");
    static public final ServiceAction REMOVE_LOAD_BALANCER      = new ServiceAction("LB:REMOVE_LOAD_BALANCER");
    static public final ServiceAction CONFIGURE_HEALTH_CHECK    = new ServiceAction("LB:CONFIGURE_HEALTH_CHECK");
    static public final ServiceAction LIST_SSL_CERTIFICATES     = new ServiceAction("LB:LIST_SSL_CERTIFICATES");
    static public final ServiceAction GET_SSL_CERTIFICATE       = new ServiceAction("LB:GET_SSL_CERTIFICATE");
    static public final ServiceAction CREATE_SSL_CERTIFICATE    = new ServiceAction("LB:CREATE_SSL_CERTIFICATE");
    static public final ServiceAction DELETE_SSL_CERTIFICATE    = new ServiceAction("LB:DELETE_SSL_CERTIFICATE");
    static public final ServiceAction SET_LB_SSL_CERTIFICATE    = new ServiceAction("LB:SET_SSL_CERTIFICATE");

    /**
     * Adds one or more data centers to the list of data centers associated with the specified load balancer. This method
     * makes sense only if load balancers are not data center aware
     * @param toLoadBalancerId the load balancer to which data centers are being added
     * @param dataCenterIdsToAdd one or more data centers to add
     * @throws CloudException an error occurred with the cloud provider while performing this action
     * @throws InternalException an error occurred within the Dasein Cloud implementation while performing this action
     * @throws OperationNotSupportedException this load balancer is not data-center aware
     */
    public void addDataCenters(@Nonnull String toLoadBalancerId, @Nonnull String ... dataCenterIdsToAdd) throws CloudException, InternalException;

    /**
     * Adds one or more IP address endpoints to the load balancer resource pool.
     * @param toLoadBalancerId the load balancer to which the endpoints are being added
     * @param ipAddresses the addresses to be added
     * @throws CloudException an error occurred with the cloud provider while performing this action
     * @throws InternalException an error occurred within the Dasein Cloud implementation while performing this action
     * @throws OperationNotSupportedException this load balancer does not support IP endpoints, or does not support adding them post-create
     */
    public void addIPEndpoints(@Nonnull String toLoadBalancerId, @Nonnull String ... ipAddresses) throws CloudException, InternalException;

    /**
     * Adds one or more virtual machine endpoints to the load balancer resource pool.
     * @param toLoadBalancerId the load balancer to which the endpoints are being added
     * @param serverIdsToAdd the IDs of the virtual machines to be added
     * @throws CloudException an error occurred with the cloud provider while performing this action<commit_msg>Fix for task #839 Implement ability to Add/remove listeners in LoadBalancer<commit_after>/**
 * Copyright (C) 2009-2014 Dell, Inc.
 * See annotations for authorship information
 *
 * ====================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ====================================================================
 */

package org.dasein.cloud.network;

import java.util.HashMap;
import java.util.Locale;

import org.dasein.cloud.AccessControlledService;
import org.dasein.cloud.CloudException;
import org.dasein.cloud.InternalException;
import org.dasein.cloud.OperationNotSupportedException;
import org.dasein.cloud.Requirement;
import org.dasein.cloud.ResourceStatus;
import org.dasein.cloud.identity.ServiceAction;

import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * Implements support for cloud load balancing services.
 * @author <NAME>
 * @author <NAME>
 * @version 2013.04 added Javadoc and did some refactoring
 * @version 2013.02 added support for health checks
 * @since unknown
 */
public interface LoadBalancerSupport extends AccessControlledService {
    static public final ServiceAction ANY                       = new ServiceAction("LB:ANY");

    static public final ServiceAction ADD_DATA_CENTERS          = new ServiceAction("LB:ADD_DC");
    static public final ServiceAction ADD_VMS                   = new ServiceAction("LB:ADD_VM");
    static public final ServiceAction CREATE_LOAD_BALANCER      = new ServiceAction("LB:CREATE_LOAD_BALANCER");
    static public final ServiceAction GET_LOAD_BALANCER         = new ServiceAction("LB:GET_LOAD_BALANCER");
    static public final ServiceAction LIST_LOAD_BALANCER        = new ServiceAction("LB:LIST_LOAD_BALANCER");
    static public final ServiceAction GET_LOAD_BALANCER_SERVER_HEALTH   = new ServiceAction("LB:GET_LOAD_BALANCER_SERVER_HEALTH");
    static public final ServiceAction REMOVE_DATA_CENTERS       = new ServiceAction("LB:REMOVE_DC");
    static public final ServiceAction REMOVE_VMS                = new ServiceAction("LB:REMOVE_VM");
    static public final ServiceAction REMOVE_LOAD_BALANCER      = new ServiceAction("LB:REMOVE_LOAD_BALANCER");
    static public final ServiceAction CONFIGURE_HEALTH_CHECK    = new ServiceAction("LB:CONFIGURE_HEALTH_CHECK");
    static public final ServiceAction LIST_SSL_CERTIFICATES     = new ServiceAction("LB:LIST_SSL_CERTIFICATES");
    static public final ServiceAction GET_SSL_CERTIFICATE       = new ServiceAction("LB:GET_SSL_CERTIFICATE");
    static public final ServiceAction CREATE_SSL_CERTIFICATE    = new ServiceAction("LB:CREATE_SSL_CERTIFICATE");
    static public final ServiceAction DELETE_SSL_CERTIFICATE    = new ServiceAction("LB:DELETE_SSL_CERTIFICATE");
    static public final ServiceAction SET_LB_SSL_CERTIFICATE    = new ServiceAction("LB:SET_SSL_CERTIFICATE");
    static public final ServiceAction CLEATE_LOAD_BALANCER_LISTENERS    = new ServiceAction("LB:CLEATE_LOAD_BALANCER_LISTENERS");
    static public final ServiceAction DELETE_LOAD_BALANCER_LISTENERS    = new ServiceAction("LB:DELETE_LOAD_BALANCER_LISTENERS");

    /**
     * Adds one or more new listeners to your load balancer.
     * @param toLoadBalancerId the load balancer to which data centers are being added
     * @param listeners the listeners to be established on create
     * @throws CloudException an error occurred with the cloud provider while performing this action
     * @throws InternalException an error occurred within the Dasein Cloud implementation while performing this action
     * @throws OperationNotSupportedException this load balancer is not data-center aware
     */
    public void addListeners(@Nonnull String toLoadBalancerId, @Nullable LbListener[] listeners) throws CloudException, InternalException;

    /**
     * Removes one or more new listeners from load balancer.
     * @param toLoadBalancerId the load balancer to which data centers are being added
     * @param listeners the listeners to be deleted
     * @throws CloudException an error occurred with the cloud provider while performing this action
     * @throws InternalException an error occurred within the Dasein Cloud implementation while performing this action
     * @throws OperationNotSupportedException this load balancer is not data-center aware
     */
    public void removeListeners(@Nonnull String toLoadBalancerId, @Nullable LbListener[] listeners) throws CloudException, InternalException;

    /**
     * Adds one or more data centers to the list of data centers associated with the specified load balancer. This method
     * makes sense only if load balancers are not data center aware
     * @param toLoadBalancerId the load balancer to which data centers are being added
     * @param dataCenterIdsToAdd one or more data centers to add
     * @throws CloudException an error occurred with the cloud provider while performing this action
     * @throws InternalException an error occurred within the Dasein Cloud implementation while performing this action
     * @throws OperationNotSupportedException this load balancer is not data-center aware
     */
    public void addDataCenters(@Nonnull String toLoadBalancerId, @Nonnull String ... dataCenterIdsToAdd) throws CloudException, InternalException;

    /**
     * Adds one or more IP address endpoints to the load balancer resource pool.
     * @param toLoadBalancerId the load balancer to which the endpoints are being added
     * @param ipAddresses the addresses to be added
     * @throws CloudException an error occurred with the cloud provider while performing this action
     * @throws InternalException an error occurred within the Dasein Cloud implementation while performing this action
     * @throws OperationNotSupportedException this load balancer does not support IP endpoints, or does not support adding them post-create
     */
    public void addIPEndpoints(@Nonnull String toLoadBalancerId, @Nonnull String ... ipAddresses) throws CloudException, InternalException;

    /**
     * Adds one or more virtual machine endpoints to the load balancer resource pool.
     * @param toLoadBalancerId the load balancer to which the endpoints are being added
     * @param serverIdsToAdd the IDs of the virtual machines to be added
     * @throws CloudException an error occurred with the cloud provider while performing this action
{'fraction_non_alphanumeric': 0.07799852832965416, 'fraction_numerical': 0.004169732646553839, 'mean_word_length': 4.468037550290568, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2891585', 'n_tokens_mistral': 3213, 'n_tokens_neox': 2985, 'n_words': 1166}