Skip to content

Commit c1d1743

Browse files
author
PureCloud Jenkins
committed
227.1.0
1 parent 535136a commit c1d1743

File tree

5,341 files changed

+5531
-6134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,341 files changed

+5531
-6134
lines changed

README.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
Documentation can be found at https://mypurecloud.github.io/platform-client-sdk-python/
77

8-
Documentation version PureCloudPlatformClientV2 227.0.0
8+
Documentation version PureCloudPlatformClientV2 227.1.0
99

1010
## Preview APIs
1111

@@ -176,7 +176,7 @@ PureCloudPlatformClientV2.configuration.proxy_username = 'YOUR_PROXY_USERNAME'
176176
PureCloudPlatformClientV2.configuration.proxy_password = 'YOUR_PROXY_PASSWORD'
177177
```
178178

179-
The Python SDK uses `urllib3.ProxyManager` to make requests when `proxy` is provided.
179+
The Python SDK uses `urllib3.ProxyManager` to make requests when `proxy` is provided with default http client implementation (refer to [Inject Custom HTTP Client](#inject-custom-http-client)).
180180

181181
#### SDK Logging
182182

@@ -410,6 +410,55 @@ api_client = PureCloudPlatformClientV2.api_client.ApiClient()
410410
# Create and set custom HTTP client
411411
http_client = CustomHttpClient()
412412
api_client.set_http_client(http_client)
413+
```
414+
415+
## Using MTLS authentication via a Gateway
416+
With Python Client applications, if there is MTLS authentication that need to be set for a gateway server (i.e. if the Genesys Cloud requests must be sent through an intermediate API gateway or equivalent, with MTLS enabled), you can use set_mtls_certificates or set_mtls_contents to set the certificates.
417+
418+
An example using set_mtls_certificates to setup MTLS for gateway is shown below
419+
420+
```python
421+
MTLS_CERT_DIR = "mtls-certs"
422+
CA_CERT_FILENAME = "ca-chain.cert.pem"
423+
CLIENT_CERT_FILENAME = "localhost.cert.pem"
424+
CLIENT_KEY_FILENAME = "localhost.key.pem"
425+
base_dir = os.path.dirname(__file__)
426+
ca_cert_path = os.path.join(base_dir, MTLS_CERT_DIR, CA_CERT_FILENAME)
427+
client_cert_path = os.path.join(base_dir, MTLS_CERT_DIR, CLIENT_CERT_FILENAME)
428+
client_key_path = os.path.join(base_dir, MTLS_CERT_DIR, CLIENT_KEY_FILENAME)
429+
PureCloudPlatformClientV2.configuration.set_mtls_certificates(client_cert_path, client_key_path, ca_cert_path)
430+
431+
apiclient_mtls = PureCloudPlatformClientV2.api_client.ApiClient()
432+
apiclient_mtls.set_gateway(
433+
hostname="mygateway.mydomain.myextension",
434+
scheme="https",
435+
port=4027,
436+
login_path="login",
437+
api_path="api"
438+
)
439+
```
440+
441+
442+
If you have content of the private keys and cert information instead of the the filepaths , you can directly set this information using set_mtls_contents
443+
444+
An example using set_mtls_contents to setup MTLS for gateway is shown below
445+
446+
```python
447+
PureCloudPlatformClientV2.configuration.set_mtls_contents(client_cert_conts, client_key_conts, ca_cert_conts) # make sure that the content of the certificate and key have been feteched properly and supplied to set_mtls_contents() function.
448+
449+
apiclient_mtls = PureCloudPlatformClientV2.api_client.ApiClient()
450+
apiclient_mtls.set_gateway(
451+
hostname="mygateway.mydomain.myextension",
452+
scheme="https",
453+
port=4027,
454+
login_path="login",
455+
api_path="api"
456+
)
457+
```
458+
459+
460+
461+
If you require a custom HTTP client to handle mTLS, you can utilize the set_http_client() method of the API client instance to integrate your own implementation. Remember that you will be responsible for configuring the mTLS settings within your custom HTTP client.
413462

414463

415464
## SDK Source Code Generation

build/PureCloudPlatformClientV2/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def __call_api(self, resource_path, method,
419419
header_params['Cookie'] = self.cookie
420420
if header_params:
421421
header_params = self.sanitize_for_serialization(header_params)
422-
header_params['purecloud-sdk'] = '227.0.0'
422+
header_params['purecloud-sdk'] = '227.1.0'
423423

424424
# path parameters
425425
if path_params:

build/PureCloudPlatformClientV2/configuration.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,39 @@ def config_file_path(self, value):
153153
if self.live_reload_config:
154154
self._config_updater()
155155

156+
def set_mtls_contents(self, certContent, keyContent, caContent):
157+
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
158+
159+
if not certContent or not keyContent or not caContent:
160+
raise ValueError("certContent, keyContent, and caContent must be provided for mTLS.")
161+
162+
if caContent:
163+
ssl_context.load_verify_locations(cafile=io.BytesIO(caContent.encode('utf-8')))
164+
else:
165+
# If no CA certs are provided, use certifi's bundle.
166+
ssl_context.load_verify_locations(cafile=certifi.where())
167+
168+
ssl_context.load_cert_chain(certfile=io.BytesIO(certContent.encode('utf-8')), keyfile=io.BytesIO(keyContent.encode('utf-8')))
169+
self.ssl_context = ssl_context
170+
171+
def set_mtls_certificates(self, certPath, keyPath, caPath = None):
172+
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
173+
174+
if not certPath or not keyPath:
175+
raise ValueError("certPath, keyPath and caPath must be provided for mTLS.")
176+
177+
if caPath:
178+
ssl_context.load_verify_locations(cafile=caPath)
179+
else:
180+
# If no CA certs are provided, use certifi's bundle.
181+
ssl_context.load_verify_locations(cafile=certifi.where())
182+
183+
ssl_context.load_cert_chain(certfile=certPath, keyfile=keyPath)
184+
self.ssl_context = ssl_context
185+
156186
def create_mtls_or_ssl_context(self):
157187
if self.ssl_context is None: # set_mtls_contents() or set_mtls_certificates() were not called.
158-
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
188+
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
159189

160190
if self.ssl_ca_cert:
161191
ssl_context.load_verify_locations(cafile=self.ssl_ca_cert)
@@ -226,7 +256,7 @@ def to_debug_report(self):
226256
"OS: {env}\n"\
227257
"Python Version: {pyversion}\n"\
228258
"Version of the API: v2\n"\
229-
"SDK Package Version: 227.0.0".\
259+
"SDK Package Version: 227.1.0".\
230260
format(env=sys.platform, pyversion=sys.version)
231261

232262
def _update_config_from_file(self):

build/PureCloudPlatformClientV2/models/audit_topic_audit_log_message.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def service_name(self, service_name: str) -> None:
296296
"""
297297
if isinstance(service_name, int):
298298
service_name = str(service_name)
299-
allowed_values = ["LanguageUnderstanding", "ContentManagement", "PeoplePermissions", "Presence", "Architect", "ContactCenter", "Quality", "SpeechAndTextAnalytics", "PredictiveEngagement", "Knowledge", "Coaching", "Learning", "Gamification", "EmployeeEngagement", "WorkforceManagement", "Triggers", "ProcessAutomation", "ResponseManagement", "Groups", "Telephony", "Outbound", "Routing", "Integrations", "Webhooks", "AnalyticsReporting", "Limits", "EmployeePerformance", "Datatables", "Messaging", "WebDeployments", "Supportability", "Callback", "Directory", "ExternalContacts", "TaskManagement", "SCIM", "NumberPurchasing", "Marketplace", "LogCapture", "GDPR", "ExternalContactsExport", "AgentConfig", "Emails", "Scripter", "Billing", "JourneyAnalytics", "NerService", "Onboarding", "SocialListening", "BusinessRules", "SocialEscalationRules", "Alerting"]
299+
allowed_values = ["LanguageUnderstanding", "ContentManagement", "PeoplePermissions", "Presence", "Architect", "ContactCenter", "Quality", "SpeechAndTextAnalytics", "PredictiveEngagement", "Knowledge", "Coaching", "Learning", "Gamification", "EmployeeEngagement", "WorkforceManagement", "Triggers", "ProcessAutomation", "ResponseManagement", "Groups", "Telephony", "Outbound", "Routing", "Integrations", "Webhooks", "AnalyticsReporting", "Limits", "EmployeePerformance", "Datatables", "Messaging", "WebDeployments", "Supportability", "Callback", "Directory", "ExternalContacts", "TaskManagement", "SCIM", "NumberPurchasing", "Marketplace", "LogCapture", "GDPR", "DSAR", "ExternalContactsExport", "AgentConfig", "Emails", "Scripter", "Billing", "JourneyAnalytics", "NerService", "Onboarding", "SocialListening", "BusinessRules", "SocialEscalationRules", "Alerting"]
300300
if service_name.lower() not in map(str.lower, allowed_values):
301301
# print("Invalid value for service_name -> " + service_name)
302302
self._service_name = "outdated_sdk_version"
@@ -397,7 +397,7 @@ def action(self, action: str) -> None:
397397
"""
398398
if isinstance(action, int):
399399
action = str(action)
400-
allowed_values = ["View", "Create", "Update", "Delete", "Move", "Copy", "Download", "ShareAdd", "ShareRemove", "Fax", "VersionCreate", "TagAdd", "TagRemove", "TagUpdate", "Add", "Remove", "MemberAdd", "MemberUpdate", "MemberRemove", "Authorize", "Deauthorize", "Authenticate", "ChangePassword", "AuthenticationFailed", "Revoke", "Checkin", "Checkout", "Deactivate", "Debug", "Publish", "Revert", "Save", "Transcode", "Upload", "WrapupCodeAdd", "WrapupCodeRemove", "Read", "Execute", "Abandon", "Archive", "Export", "RestoreRequest", "RestoreComplete", "UpdateRetention", "ApplyProtection", "RevokeProtection", "Rotate", "DeleteAll", "Reassign", "Unarchive", "Activate", "Assign", "Unassign", "Reset", "Reschedule", "Complete", "Cancel", "Unpublish", "Purge", "Processed", "Enable", "Disable", "Recycle", "Append", "ContactsUpdated", "ContactsDeleted", "Restore", "Block", "Unblock", "Open", "Approved", "Rejected", "Rollback", "ImplementingChange", "ChangeImplemented", "ImplementingRollback", "RollbackImplemented", "Write", "Replace", "UpdateInService", "UpdateOutOfService", "Cycle", "Scale", "AsgInservice", "AwsOutofservice", "AsgTerminate", "Detach", "Terminate", "BlockUpgrade", "UnblockUpgrade", "AsgSwapInstanceType", "RecreateAsg", "DeleteUnconfiguredEdge", "GetAsgList", "GetAsg", "UpgradeOrganizationSite", "UpdateAwsConfig", "GetAwsConfig", "DeleteGhostEdgeRecord", "UpgradeCleanup", "IpAllowlistClear", "AddPairingRole", "Verify", "RestoreDeleted", "RestoreAll", "Approve", "Reject", "Reverse", "Send", "HardDelete", "SoftDelete", "Submit", "EnableCapture", "DownloadCapture", "Succeeded", "Failed", "Initiate", "ReverseManually", "Calculate", "Provisioned", "UpdateAborted"]
400+
allowed_values = ["View", "Create", "Update", "Delete", "Move", "Copy", "Download", "ShareAdd", "ShareRemove", "Fax", "VersionCreate", "TagAdd", "TagRemove", "TagUpdate", "Add", "Remove", "MemberAdd", "MemberUpdate", "MemberRemove", "Authenticate", "AuthenticationFailed", "SingleLogout", "SingleLogoutFailed", "Authorize", "Deauthorize", "AuthorizationChanged", "ChangePassword", "Revoke", "Checkin", "Checkout", "Deactivate", "Debug", "Publish", "Revert", "Save", "Transcode", "Upload", "WrapupCodeAdd", "WrapupCodeRemove", "Read", "Execute", "Abandon", "Archive", "Export", "RestoreRequest", "RestoreComplete", "UpdateRetention", "ApplyProtection", "RevokeProtection", "Rotate", "DeleteAll", "Reassign", "Unarchive", "Activate", "Assign", "Unassign", "Reset", "Reschedule", "Complete", "Cancel", "Unpublish", "Purge", "Processed", "Enable", "Disable", "Recycle", "Append", "ContactsUpdated", "ContactsDeleted", "Restore", "Block", "Unblock", "Open", "Approved", "Rejected", "Rollback", "ImplementingChange", "ChangeImplemented", "ImplementingRollback", "RollbackImplemented", "Write", "Replace", "UpdateInService", "UpdateOutOfService", "Cycle", "Scale", "AsgInservice", "AwsOutofservice", "AsgTerminate", "Detach", "Terminate", "BlockUpgrade", "UnblockUpgrade", "AsgSwapInstanceType", "RecreateAsg", "DeleteUnconfiguredEdge", "GetAsgList", "GetAsg", "UpgradeOrganizationSite", "UpdateAwsConfig", "GetAwsConfig", "DeleteGhostEdgeRecord", "UpgradeCleanup", "IpAllowlistClear", "AddPairingRole", "Verify", "RestoreDeleted", "RestoreAll", "Approve", "Reject", "Reverse", "Send", "HardDelete", "SoftDelete", "Submit", "EnableCapture", "DownloadCapture", "Succeeded", "Failed", "Initiate", "ReverseManually", "Calculate", "Provisioned", "UpdateAborted"]
401401
if action.lower() not in map(str.lower, allowed_values):
402402
# print("Invalid value for action -> " + action)
403403
self._action = "outdated_sdk_version"
@@ -426,7 +426,7 @@ def entity_type(self, entity_type: str) -> None:
426426
"""
427427
if isinstance(entity_type, int):
428428
entity_type = str(entity_type)
429-
allowed_values = ["Feedback", "Document", "Workspace", "Tag", "AccessToken", "OAuthClientAuthorization", "AuthOrganization", "OAuthClient", "AuthUser", "OrganizationAuthorizationTrust", "OrganizationAuthorizationUserTrust", "Role", "RoleSettings", "Policy", "VoicemailUserPolicy", "UserPresence", "DependencyTrackingBuild", "Flow", "Prompt", "PromptResource", "FlowOutcome", "FlowMilestone", "Grammar", "GrammarLanguage", "AgentRoutingInfo", "Queue", "WrapupCode", "MaxOrgRoutingUtilizationCapacity", "ConversationAttributes", "RoutingUtilizationTag", "Evaluation", "Calibration", "Survey", "EvaluationForm", "SurveyForm", "Recording", "ScreenRecording", "BulkActions", "OrphanedRecording", "RecordingAnnotation", "RecordingSettings", "RecordingKey", "RecordingKeyConfig", "Topic", "Program", "Category", "SentimentFeedback", "DictionaryFeedback", "InteractionReprocessingJob", "Segment", "Outcome", "ActionMap", "ActionTemplate", "ClickstreamSettings", "EventType", "SessionType", "KnowledgeBase", "KnowledgeCategory", "KnowledgeContext", "KnowledgeContextValue", "KnowledgeDocument", "KnowledgeDocumentVariation", "KnowledgeLabel", "KnowledgeTraining", "KnowledgeSearchFeedback", "TranscriptionSettings", "SpeechTextAnalyticsSettings", "Appointment", "Annotation", "Organization", "Module", "Rule", "Assignment", "Contest", "Recognition", "ActivityCode", "ActivityPlan", "ActivityPlanOccurrence", "AdherenceExplanation", "AlternativeShift", "BusinessUnit", "Forecast", "ManagementUnit", "PlanningGroup", "Schedule", "ServiceGoalTemplate", "ShiftTrade", "TimeOffLimit", "TimeOffPlan", "TimeOffRequest", "WorkPlan", "WorkPlanBid", "WorkPlanBidGroup", "WorkPlanRotation", "HistoricalData", "StaffingGroup", "CapacityPlan", "Trigger", "Response", "ResponseLibrary", "ResponseAsset", "SkillGroup", "DirectoryGroup", "Team", "SkillGroupDefinition", "Edge", "EdgeGroup", "VoicemailPolicy", "RoutingTranscriptionSettings", "Trunk", "TrunkBase", "ScheduleGroup", "EmergencyGroup", "IVR", "AlertablePresencesOverrides", "DID", "DIDPool", "Extension", "ExtensionPool", "Phone", "PhoneBase", "Line", "LineBase", "OutboundRoute", "NumberPlan", "Site", "AttemptLimits", "CallableTimeSet", "Campaign", "CampaignRule", "CampaignSchedule", "Sequence", "SequenceSchedule", "ContactList", "ContactListFilter", "ContactListTemplate", "DigitalRuleSet", "DNCList", "FileSpecificationTemplate", "ImportTemplate", "OrganizationSettings", "CallAnalysisResponseSet", "RuleSet", "WrapUpCodeMapping", "MessagingCampaign", "MessagingCampaignSchedule", "EmailCampaignSchedule", "Predictor", "KpiSpecification", "Metric", "Status", "Profile", "ProfileMembers", "Action", "ActionDraft", "Integration", "Webhook", "DashboardSettings", "InsightSettings", "AnalyticsReportingSettings", "CustomCalculations", "ScheduledExports", "Exports", "ExportPdfTemplates", "ChangeRequest", "Migration", "ExternalMetricsDefinition", "ExternalMetricsData", "Schema", "Row", "Bulk", "SupportedContent", "ConversationPhoneNumber", "ConversationRecipient", "ConversationAccount", "ConversationDefaultSupportedContent", "ConversationThreadingWindow", "Deployment", "Configuration", "ConfigurationVersion", "EdgePreferences", "EdgeTraceLevel", "OrganizationIntegrationsAccess", "SupportFile", "EdgeLogZip", "Pcaps", "MediaDiagnosticsTraceFile", "EdgePcaps", "EdgeLog", "OrganizationFeature", "Product", "User", "Location", "Conversation", "OrganizationSuspension", "OperationalEvent", "Participant", "ContactSchema", "ExternalOrganizationSchema", "Workbin", "Worktype", "BulkJob", "Credential", "NumberOrder", "EnterpriseAgreement", "VendorListing", "GdprRequest", "ExportRequest", "DefaultPanelSettings", "InboundDomain", "OutboundDomain", "InboundRoute", "OrganizationLimits", "ComposerPage", "ComposerPublishedScript", "ComposerScript", "ComposerTemplate", "IntentMiner", "TopicMiner", "SoftSuspension", "JourneyView", "CustomEntity", "DirectoryFeature", "RuleCategory", "DecisionTable", "DecisionTableVersion", "DecisionTableRow", "EscalationRule", "Rules"]
429+
allowed_values = ["Feedback", "Document", "Workspace", "Tag", "UserSamlAuthentication", "AccessToken", "OAuthClientAuthorization", "AuthOrganization", "OAuthClient", "AuthUser", "OrganizationAuthorizationTrust", "OrganizationAuthorizationUserTrust", "Role", "RoleSettings", "Policy", "VoicemailUserPolicy", "UserPresence", "DependencyTrackingBuild", "Flow", "Prompt", "PromptResource", "FlowOutcome", "FlowMilestone", "Grammar", "GrammarLanguage", "AgentRoutingInfo", "Queue", "WrapupCode", "MaxOrgRoutingUtilizationCapacity", "ConversationAttributes", "RoutingUtilizationTag", "Evaluation", "Calibration", "Survey", "EvaluationForm", "SurveyForm", "Recording", "ScreenRecording", "BulkActions", "OrphanedRecording", "RecordingAnnotation", "RecordingSettings", "RecordingKey", "RecordingKeyConfig", "Topic", "Program", "Category", "SentimentFeedback", "DictionaryFeedback", "InteractionReprocessingJob", "Segment", "Outcome", "ActionMap", "ActionTemplate", "ClickstreamSettings", "EventType", "SessionType", "KnowledgeBase", "KnowledgeCategory", "KnowledgeContext", "KnowledgeContextValue", "KnowledgeDocument", "KnowledgeDocumentVariation", "KnowledgeLabel", "KnowledgeTraining", "KnowledgeSearchFeedback", "TranscriptionSettings", "SpeechTextAnalyticsSettings", "Appointment", "Annotation", "Organization", "Module", "Rule", "Assignment", "Contest", "Recognition", "ActivityCode", "ActivityPlan", "ActivityPlanOccurrence", "AdherenceExplanation", "AlternativeShift", "BusinessUnit", "Forecast", "ManagementUnit", "PlanningGroup", "Schedule", "ServiceGoalTemplate", "ShiftTrade", "TimeOffLimit", "TimeOffPlan", "TimeOffRequest", "WorkPlan", "WorkPlanBid", "WorkPlanBidGroup", "WorkPlanRotation", "HistoricalData", "StaffingGroup", "CapacityPlan", "Trigger", "Response", "ResponseLibrary", "ResponseAsset", "SkillGroup", "DirectoryGroup", "Team", "SkillGroupDefinition", "Edge", "EdgeGroup", "VoicemailPolicy", "RoutingTranscriptionSettings", "Trunk", "TrunkBase", "ScheduleGroup", "EmergencyGroup", "IVR", "AlertablePresencesOverrides", "DID", "DIDPool", "Extension", "ExtensionPool", "Phone", "PhoneBase", "Line", "LineBase", "OutboundRoute", "NumberPlan", "Site", "AttemptLimits", "CallableTimeSet", "Campaign", "CampaignRule", "CampaignSchedule", "Sequence", "SequenceSchedule", "ContactList", "ContactListFilter", "ContactListTemplate", "DigitalRuleSet", "DNCList", "FileSpecificationTemplate", "ImportTemplate", "OrganizationSettings", "CallAnalysisResponseSet", "RuleSet", "WrapUpCodeMapping", "MessagingCampaign", "MessagingCampaignSchedule", "EmailCampaignSchedule", "Predictor", "KpiSpecification", "Metric", "Status", "Profile", "ProfileMembers", "Action", "ActionDraft", "Integration", "Webhook", "DashboardSettings", "InsightSettings", "AnalyticsReportingSettings", "CustomCalculations", "ScheduledExports", "Exports", "ExportPdfTemplates", "ChangeRequest", "Migration", "ExternalMetricsDefinition", "ExternalMetricsData", "Schema", "Row", "Bulk", "SupportedContent", "ConversationPhoneNumber", "ConversationRecipient", "ConversationAccount", "ConversationDefaultSupportedContent", "ConversationThreadingWindow", "Deployment", "Configuration", "ConfigurationVersion", "EdgePreferences", "EdgeTraceLevel", "OrganizationIntegrationsAccess", "SupportFile", "EdgeLogZip", "Pcaps", "MediaDiagnosticsTraceFile", "EdgePcaps", "EdgeLog", "OrganizationFeature", "Product", "User", "Location", "Conversation", "OrganizationSuspension", "OperationalEvent", "Participant", "ContactSchema", "ExternalOrganizationSchema", "Workbin", "Worktype", "BulkJob", "Credential", "NumberOrder", "EnterpriseAgreement", "VendorListing", "GdprRequest", "DsarRequest", "ExportRequest", "DefaultPanelSettings", "InboundDomain", "OutboundDomain", "InboundRoute", "OrganizationLimits", "ComposerPage", "ComposerPublishedScript", "ComposerScript", "ComposerTemplate", "IntentMiner", "TopicMiner", "SoftSuspension", "JourneyView", "CustomEntity", "DirectoryFeature", "RuleCategory", "DecisionTable", "DecisionTableVersion", "DecisionTableRow", "EscalationRule", "Rules"]
430430
if entity_type.lower() not in map(str.lower, allowed_values):
431431
# print("Invalid value for entity_type -> " + entity_type)
432432
self._entity_type = "outdated_sdk_version"

0 commit comments

Comments
 (0)