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());
}
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;
}
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();
}
}
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);
}
}
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;
}
Aggregations