<commit_before># How to write a Hurtle-compatible service?

We will use examples written in Python here but keep in mind that Service Orchestrators can use any language supported by OpenShift as long as they implement the necessary calls.

Writing a service requires a developer to write the following components:

* a Service Definition, which will be the *Service Manager* entrypoint for the new se/Users/florian/repos/hurtle/docs/how_to_write_a_hurtle_service.mdrvice.
* a Service Bundle, containing all necessary details for the deployment and management of a service.

## Service Definition

Each service type is given an identity and has a set of parameters defined. Below an example in :

	from occi.core_model import Kind
	from occi.core_model import Resource
	from sm.service import Service
	from sm.service import MCNApplication
	
	if __name__ == '__main__':
	
	    # defines the service to offer - the service owner defines this
	    my_svc_type = Kind(
	        'http://schemas.hurtle.it/occi/sm#',
	        'my_service',
	        title='This is an example service type',
	        attributes={
	            'endpoint.my_service.mgt': 'immutable',
	            'endpoint.other_service.mgt': 'mutable'
	        },
	        related=[Resource.kind],
	        actions=[]
	    )
	
	    # Create a service
	    srv = Service(MCNApplication(), my_svc_type)
	<commit_msg>Update how_to_write_a_hurtle_service.md<commit_after># How to write a Hurtle-compatible service?

We will use examples written in Python here but keep in mind that Service Orchestrators can use any language supported by OpenShift as long as they implement the necessary calls.

Writing a service requires a developer to write the following components:

* a Service Definition, which will be the *Service Manager* entrypoint for the new service.
* a Service Bundle, containing all necessary details for the deployment and management of a service.

## Service Definition

Each service type is given an identity and has a set of parameters defined. Below an example in :

	from occi.core_model import Kind
	from occi.core_model import Resource
	from sm.service import Service
	from sm.service import MCNApplication
	
	if __name__ == '__main__':
	
	    # defines the service to offer - the service owner defines this
	    my_svc_type = Kind(
	        'http://schemas.hurtle.it/occi/sm#',
	        'my_service',
	        title='This is an example service type',
	        attributes={
	            'endpoint.my_service.mgt': 'immutable',
	            'endpoint.other_service.mgt': 'mutable'
	        },
	        related=[Resource.kind],
	        actions=[]
	    )
	
	    # Create a service
	    srv = Service(MCNApplication(), my_svc_type)
	
{'fraction_non_alphanumeric': 0.0664451827242525, 'fraction_numerical': 0.0, 'mean_word_length': 3.2476489028213167, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6523973', 'n_tokens_mistral': 765, 'n_tokens_neox': 714, 'n_words': 299}