Search in sources :

Example 36 with Service

use of com.google.monitoring.v3.Service in project api-snippets by TwilioDevEd.

the class Example method main.

public static void main(String[] args) {
    // Authenticate with Twilio
    Twilio.init(API_KEY, API_SECRET, ACCOUNT_SID);
    // Update the service webhooks
    String newMessageTemplate = "A New message in ${CHANNEL} from ${USER}: " + "${MESSAGE}";
    Service service = Service.updater(SERVICE_SID).setNotificationsNewMessageEnabled(true).setNotificationsNewMessageTemplate(newMessageTemplate).setNotificationsNewMessageSound("default").update();
    System.out.println(service.getSid());
}
Also used : Service(com.twilio.rest.chat.v2.Service)

Example 37 with Service

use of com.google.monitoring.v3.Service in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method getEndpoints.

/**
 * Get endpoints defined in the provided WSDL description.
 *
 * @param description WSDL 2.0 description
 * @return a Map of endpoint names and their URIs.
 * @throws APIMgtWSDLException if error occurs while reading endpoints
 */
private Map<String, String> getEndpoints(Description description) throws APIMgtWSDLException {
    Service[] services = description.getServices();
    Map<String, String> serviceEndpointMap = new HashMap<>();
    for (Service service : services) {
        Endpoint[] endpoints = service.getEndpoints();
        for (Endpoint endpoint : endpoints) {
            serviceEndpointMap.put(endpoint.getName().toString(), endpoint.getAddress().toString());
        }
    }
    return serviceEndpointMap;
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) HashMap(java.util.HashMap) Service(org.apache.woden.wsdl20.Service)

Example 38 with Service

use of com.google.monitoring.v3.Service in project openstack4j by ContainX.

the class BaseOpenStackService method getServiceVersion.

@SuppressWarnings("rawtypes")
protected int getServiceVersion() {
    OSClientSession session = OSClientSession.getCurrent();
    if (session.getAuthVersion() == AuthVersion.V3) {
        SortedSet<? extends Service> services = ((OSClientSession.OSClientSessionV3) session).getToken().getAggregatedCatalog().get(serviceType.getType());
        Service service = ((OSClientSession.OSClientSessionV3) session).getToken().getAggregatedCatalog().get(serviceType.getType()).first();
        if (services.isEmpty()) {
            return 1;
        }
        return service.getVersion();
    } else {
        SortedSet<? extends Access.Service> services = ((OSClientSession.OSClientSessionV2) session).getAccess().getAggregatedCatalog().get(serviceType.getType());
        Access.Service service = ((OSClientSession.OSClientSessionV2) session).getAccess().getAggregatedCatalog().get(serviceType.getType()).first();
        if (services.isEmpty()) {
            return 1;
        }
        return service.getVersion();
    }
}
Also used : Access(org.openstack4j.model.identity.v2.Access) Service(org.openstack4j.model.identity.v3.Service)

Example 39 with Service

use of com.google.monitoring.v3.Service in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method updateEndpointsOfSingleWSDL.

/**
 * Update the endpoint information of the provided WSDL definition when an API and the environment details are
 * provided
 *
 * @param api API
 * @param environmentName name of the gateway environment
 * @param environmentType type of the gateway environment
 * @param wsdlDescription WSDL 2.0 definition
 * @throws APIMgtWSDLException when error occurred while updating the endpoints
 */
private void updateEndpointsOfSingleWSDL(API api, String environmentName, String environmentType, Description wsdlDescription) throws APIMgtWSDLException {
    Service[] serviceMap = wsdlDescription.getServices();
    String organization = api.getOrganization();
    try {
        for (Service svc : serviceMap) {
            Endpoint[] portMap = svc.getEndpoints();
            for (Endpoint endpoint : portMap) {
                EndpointElement element = endpoint.toElement();
                String endpointTransport = determineURLTransport(endpoint.getAddress().getScheme(), api.getTransports());
                setAddressUrl(element, new URI(APIUtil.getGatewayEndpoint(endpointTransport, environmentName, environmentType, organization) + api.getContext()));
            }
        }
    } catch (URISyntaxException | APIManagementException e) {
        throw new APIMgtWSDLException("Error while setting gateway access URLs in the WSDL", e);
    }
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) APIMgtWSDLException(org.wso2.carbon.apimgt.impl.wsdl.exceptions.APIMgtWSDLException) Service(org.apache.woden.wsdl20.Service) URISyntaxException(java.net.URISyntaxException) EndpointElement(org.apache.woden.wsdl20.xml.EndpointElement) URI(java.net.URI)

Example 40 with Service

use of com.google.monitoring.v3.Service in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method getEndpoints.

/**
 * Get endpoints defined in the provided WSDL description.
 *
 * @param description WSDL 2.0 description
 * @return a Map of endpoint names and their URIs.
 * @throws APIMgtWSDLException if error occurs while reading endpoints
 */
private Map<String, String> getEndpoints(Description description) throws APIMgtWSDLException {
    Service[] services = description.getServices();
    Map<String, String> serviceEndpointMap = new HashMap<>();
    for (Service service : services) {
        Endpoint[] endpoints = service.getEndpoints();
        for (Endpoint endpoint : endpoints) {
            serviceEndpointMap.put(endpoint.getName().toString(), endpoint.getAddress().toString());
        }
    }
    return serviceEndpointMap;
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) HashMap(java.util.HashMap) Service(org.apache.woden.wsdl20.Service)

Aggregations

Test (org.junit.jupiter.api.Test)33 Test (org.junit.Test)30 Service (io.fabric8.knative.serving.v1.Service)28 Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)22 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)22 AbstractMessage (com.google.protobuf.AbstractMessage)19 CoreException (org.eclipse.core.runtime.CoreException)18 MockGrpcService (com.google.api.gax.grpc.testing.MockGrpcService)16 Service (com.google.monitoring.v3.Service)16 IOException (java.io.IOException)16 HashMap (java.util.HashMap)14 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)13 ArrayList (java.util.ArrayList)12 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)11 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)11 StatusRuntimeException (io.grpc.StatusRuntimeException)11 ProdBuildResults (io.quarkus.test.ProdBuildResults)11 ProdModeTestResults (io.quarkus.test.ProdModeTestResults)11 QuarkusProdModeTest (io.quarkus.test.QuarkusProdModeTest)11 Path (java.nio.file.Path)11