Create a service
  @param resource_root: The root Resource object.
  @param name: Service name
  @param service_type: Service type
  @param cluster_name: Cluster name
  @return: An ApiService object
322222
def create_service(resource_root, name, service_type,
                   cluster_name="default"):
  
  apiservice = ApiService(resource_root, name, service_type)
  return call(resource_root.post,
      SERVICES_PATH % (cluster_name,),
      ApiService, True, data=[apiservice])[0]
582230
public OvhTask serviceName_node_hostname_role_POST(String serviceName, String hostname, OvhRoleTypeEnum type) throws IOException {
		String qPath = "/cluster/hadoop/{serviceName}/node/{hostname}/role";
		StringBuilder sb = path(qPath, serviceName, hostname);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "type", type);
		String resp = exec(qPath, "POST", sb.toString(), o);
		return convertTo(resp, OvhTask.class);
	}
92606
def _get_or_create_service_key(self):
        
        keys = self.service._get_service_keys(self.name)
        for key in keys['resources']:
            if key['entity']['name'] == self.service_name:
                return self.service.get_service_key(self.name,
                        self.service_name)

        self.service.create_service_key(self.name, self.service_name)
        return self.service.get_service_key(self.name, self.service_name)
516740
def makeService(self, options):
        
        return NodeService(
            port=options['port'],
            host=options['host'],
            broker_host=options['broker_host'],
            broker_port=options['broker_port'],
            debug=options['debug']
        )
746579
def _create(self, **kwargs):
        '''
        '''

        try:
            return super(Service, self)._create(**kwargs)
        except HTTPError as ex:
            if "The configuration was updated successfully but could not be " \
                    "retrieved" not in ex.response.text:
                raise

            # BIG-IP® will create in Common partition if none is given.
            # In order to create the uri properly in this class's load,
            # drop in Common as the partition in kwargs.
            if 'partition' not in kwargs:
                kwargs['partition'] = 'Common'
            # Pop all but the necessary load kwargs from the kwargs given to
            # create. Otherwise, load may fail.
            kwargs_copy = kwargs.copy()
            for key in kwargs_copy:
                if key not in self._meta_data['required_load_parameters']:
                    kwargs.pop(key)
            # If response was created successfully, do a local_update.
            # If not, call to overridden _load method via load
            return self.load(**kwargs)
882671
def create_resource(resource, opts = {})
      data, _status_code, _headers = create_resource_with_http_info(resource, opts)
      return data
    end
33507
public static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType) {
    return child(parentResource, name, resourceType, ValueMap.EMPTY);
  }
224633
public static base_response create(nitro_service client, systembackup resource) throws Exception {
		systembackup createresource = new systembackup();
		createresource.filename = resource.filename;
		createresource.level = resource.level;
		createresource.comment = resource.comment;
		return createresource.perform_operation(client,"create");
	}
1181666
def custom_resource(self, name, restype, factclass, props):
	
		
		
		return CustomResource(self.__endpoint, name, restype, factclass, props)
644497
def service_create(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(keep_name=True, **kwargs)
    return cloud.create_service(**kwargs)
1032290
def create_resource_model_instance(resource_instance):
        
        resource_model = ResourceModelParser.get_resource_model(resource_instance)
        resource_class_name = ResourceModelParser.get_resource_model_class_name(
            resource_model)
        # print 'Family name is ' + resource_class_name
        instance = ResourceModelParser.get_class('cloudshell.cp.vcenter.models.' + resource_class_name)
        return instance
1155704
def get_service_types(self):
    
    resp = self._get_resource_root().get(self._path() + '/serviceTypes')
    return resp[ApiList.LIST_KEY]
1007583
public ServiceRefHandlerType<ServiceRefType<T>> getOrCreateHandler()
   {
      List<Node> nodeList = childNode.get("handler");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ServiceRefHandlerTypeImpl<ServiceRefType<T>>(this, "handler", childNode, nodeList.get(0));
      }
      return createHandler();
   }
194157
def create(self):
        
        self.service.create()

        os.environ[predix.config.get_env_key(self.use_class, 'host')] = self.get_eventhub_host()
        os.environ[predix.config.get_env_key(self.use_class, 'port')] = self.get_eventhub_grpc_port()
        os.environ[predix.config.get_env_key(self.use_class, 'wss_publish_uri')] = self.get_publish_wss_uri()
        os.environ[predix.config.get_env_key(self.use_class, 'zone_id')] = self.get_zone_id()
1360148
def create_service(kwargs=None, conn=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The create_service function must be called with -f or --function.'
        )

    if not conn:
        conn = get_conn()

    if kwargs is None:
        kwargs = {}

    if 'name' not in kwargs:
        raise SaltCloudSystemExit('A name must be specified as "name"')

    if 'label' not in kwargs:
        raise SaltCloudSystemExit('A label must be specified as "label"')

    if 'location' not in kwargs and 'affinity_group' not in kwargs:
        raise SaltCloudSystemExit('Either a location or an affinity_group '
                                  'must be specified (but not both)')

    try:
        data = conn.create_hosted_service(
            kwargs['name'],
            kwargs['label'],
            kwargs.get('description', None),
            kwargs.get('location', None),
            kwargs.get('affinity_group', None),
            kwargs.get('extended_properties', None),
        )
        return {'Success': 'The service was successfully created'}
    except AzureConflictHttpError:
        raise SaltCloudSystemExit('There was a conflict. This usually means that the service already exists.')
285139
def create(self, name, provider='AwsEKS'):
        
        # ----- Create K8s cluster on provider -------
        # Create cluster object
        Cluster = getattr(providers, provider)
        cluster = Cluster(name=name, ssh_key_name='zsailer')
        cluster.create()

        # -------- Add cluster to kubeconf -----------

        # Add cluster to kubeconf
        self.kubeconf.open()
        self.kubeconf.add_cluster(
            cluster.cluster_name,
            server=cluster.endpoint_url,
            certificate_authority_data=cluster.ca_cert
        )

        # Add a user to kubeconf
        self.kubeconf.add_user(name)

        # Add a user exec call for this provider.
        self.kubeconf.add_to_user(
            name,
            **cluster.kube_user_data
        )

        # Add context mapping user to cluster.
        self.kubeconf.add_context(
            name,
            cluster_name=cluster.cluster_name,
            user_name=cluster.name
        )

        # Switch contexts.
        self.kubeconf.set_current_context(name)

        # Commit changes to file.
        self.kubeconf.close()
        
        # ------ Setup autorization -------
        kubectl('apply', input=cluster.get_auth_config())

        # -------- Setup Storage ----------
        kubectl('delete', 'storageclass', 'gp2')        
        kubectl('apply', input=cluster.get_storage_config())

        # ------- setup helm locally ------
        kubectl(
            '--namespace',
            'kube-system',
            'create',
            'serviceaccount',
            'tiller'
        )

        kubectl(
            'create',
            'clusterrolebinding',
            'tiller',
            '--clusterrole=cluster-admin',
            '--serviceaccount=kube-system:tiller'
        )

        # -------- Initialize Helm -----------
        helm(
            'init',
            '--service-account',
            'tiller'
        )

        # --------- Secure Helm --------------
        kubectl(
            'patch',
            'deployment',
            'tiller-deploy',
            namespace='kube-system',
            type='json',
            patch='[{"op": "add", "path": "/spec/template/spec/containers/0/command", "value": ["/tiller", "--listen=localhost:44134"]}]'
        )
664688
def create_host(resource_root, host_id, name, ipaddr, rack_id=None):
  
  apihost = ApiHost(resource_root, host_id, name, ipaddr, rack_id)
  return call(resource_root.post, HOSTS_PATH, ApiHost, True, data=[apihost])[0]