use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project axis-axis2-java-core by apache.
the class WSDL20ToAxisServiceBuilder method processService.
private void processService() throws AxisFault {
Service[] services = description.getServices();
if (services.length == 0) {
throw new AxisFault("No wsdlService found in the WSDL");
}
if (serviceName != null) {
for (int i = 0; i < services.length; i++) {
if (serviceName.equals(services[i].getName())) {
wsdlService = services[i];
// found it. Stop looking.
break;
}
}
if (wsdlService == null) {
throw new AxisFault("Service with the specified name not found in the WSDL : " + serviceName.getLocalPart());
}
} else {
wsdlService = services[0];
}
axisService.setName(wsdlService.getName().getLocalPart());
Interface serviceInterface = wsdlService.getInterface();
axisService.addParameter(new Parameter(WSDL2Constants.INTERFACE_LOCAL_NAME, serviceInterface.getName().getLocalPart()));
processInterface(serviceInterface);
if (isCodegen) {
axisService.setOperationsNameList(operationNames);
}
processEndpoints(serviceInterface);
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project ovirt-engine-sdk-java by oVirt.
the class HttpConnection method followLink.
@Override
public <TYPE> TYPE followLink(TYPE object) {
if (!isLink(object)) {
throw new Error("Can't follow link because object don't have any");
}
String href = getHref(object);
if (href == null) {
throw new Error("Can't follow link because the 'href' attribute does't have a value");
}
try {
URL url = new URL(getUrl());
String prefix = url.getPath();
if (!prefix.endsWith("/")) {
prefix += "/";
}
if (!href.startsWith(prefix)) {
throw new Error("The URL '" + href + "' isn't compatible with the base URL of the connection");
}
// Get service based on path
String path = href.substring(prefix.length());
Service service = systemService().service(path);
// Obtain method which provides result object and invoke it:
Method get;
if (object instanceof ListWithHref) {
get = service.getClass().getMethod("list");
} else {
get = service.getClass().getMethod("get");
}
Object getRequest = get.invoke(service);
Method send = getRequest.getClass().getMethod("send");
send.setAccessible(true);
Object getResponse = send.invoke(getRequest);
for (Method obtainObject : getResponse.getClass().getDeclaredMethods()) {
if (obtainObject.getParameterCount() == 0) {
obtainObject.setAccessible(true);
return (TYPE) obtainObject.invoke(getResponse);
}
}
throw new NoSuchMethodException("No obtain method found");
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
throw new Error(String.format("Unexpected error while following link \"%1$s\"", href), ex);
} catch (MalformedURLException ex) {
throw new Error(String.format("Error while creating URL \"%1$s\"", getUrl()), ex);
}
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project java-servicedirectory by googleapis.
the class ServicesCreate method createService.
// Create a new service.
public static void createService(String projectId, String locationId, String namespaceId, String serviceId) throws IOException {
// the "close" method on the client to safely clean up any remaining background resources.
try (RegistrationServiceClient client = RegistrationServiceClient.create()) {
// The namespace to create the service in.
NamespaceName parent = NamespaceName.of(projectId, locationId, namespaceId);
// The service object to create.
// Optionally add some annotations for the service.
Service service = Service.newBuilder().putAnnotations("protocol", "tcp").build();
// Send the request to create the namespace.
Service createdService = client.createService(parent, service, serviceId);
// Process the response.
System.out.println("Created Service: " + createdService.getName());
System.out.println("Annotations: " + createdService.getAnnotations());
}
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project openstack4j by ContainX.
the class KeystoneToken method getAggregatedCatalog.
/**
* {@inheritDoc}
*/
@Override
@JsonIgnore
public SortedSetMultimap<String, Service> getAggregatedCatalog() {
if (aggregatedCatalog == null) {
synchronized (this) {
if (aggregatedCatalog == null) {
aggregatedCatalog = TreeMultimap.create();
for (Service sc : catalog) {
String nameKey = TYPE_WITHOUT_VERSION.apply(sc.getName());
String typeKey = TYPE_WITHOUT_VERSION.apply(sc.getType());
aggregatedCatalog.put(nameKey, sc);
aggregatedCatalog.put(typeKey, sc);
}
}
}
}
return aggregatedCatalog;
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project cloudbreak by hortonworks.
the class OpenStackClient method getRegion.
public Set<String> getRegion(CloudCredential cloudCredential) {
Access access = createAccess(cloudCredential);
Token token = createToken(cloudCredential);
Set<String> regions = new HashSet<>();
if (token == null && access == null) {
throw new CloudConnectorException("Unsupported keystone version");
} else if (token != null) {
for (Service service : token.getCatalog()) {
for (Endpoint endpoint : service.getEndpoints()) {
regions.add(endpoint.getRegion());
}
}
} else {
for (Access.Service service : access.getServiceCatalog()) {
for (org.openstack4j.model.identity.v2.Endpoint endpoint : service.getEndpoints()) {
regions.add(endpoint.getRegion());
}
}
}
LOGGER.info("regions from openstack: {}", regions);
return regions;
}
Aggregations