MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / create

Method create

python/example_code/ssm/document.py:33–55  ·  view source on GitHub ↗

Creates a document. :param content: The content of the document. :param name: The name of the document.

(self, content, name)

Source from the content-addressed store, hash-verified

31
32 # snippet-start:[python.example_code.ssm.CreateDocument]
33 def create(self, content, name):
34 """
35 Creates a document.
36
37 :param content: The content of the document.
38 :param name: The name of the document.
39 """
40 try:
41 self.ssm_client.create_document(
42 Name=name, Content=content, DocumentType="Command"
43 )
44 self.name = name
45 except self.ssm_client.exceptions.DocumentAlreadyExists:
46 print(f"Document {name} already exists.")
47 self.name = name
48 except ClientError as err:
49 logger.error(
50 "Couldn't create %s. Here's why: %s: %s",
51 name,
52 err.response["Error"]["Code"],
53 err.response["Error"]["Message"],
54 )
55 raise
56
57 # snippet-end:[python.example_code.ssm.CreateDocument]
58

Callers 1

test_createFunction · 0.95

Calls

no outgoing calls

Tested by 1

test_createFunction · 0.76