# Create Hubspot contact and enroll to Hubspot Workflow hubspot_helper = Hubspot_API_Helper("cba66474-e4e4-4f5b-9b9b-35620577f343") hubspot_helper.create_contact(first_name, last_name, email, company, phone) hubspot_helper.change_contact_property(email, "cloudshell_trial_password", generated_password) hubspot_helper.change_contact_property(email, "cloudshell_trial_end_date", str(reservation_end_time_in_ms)) hubspot_helper.change_contact_property(email, "cloudshell_trial_owner", owner_email) hubspot_helper.enroll_contact_to_workflow(email, "1980406") api.WriteMessageToReservationOutput(reservationContext["id"], "6. Creating Trial Resource") # Create Trial Resource and add to reservation create_res_result = api.CreateResource("CloudShell Trial", "CloudShell VE Trial", "CS Trial {0}".format(domain_name), "NA", "CloudShell Trials", resourceDescription="Trial resource for {0} {1}".format(first_name, last_name)) res_att_values = {"Company Name": company, "email": email, "First Name": first_name, "Last Name": last_name, "Phone Number": phone, "Quali Owner": owner_email} api.SetAttributesValues([ResourceAttributesUpdateRequest(create_res_result.Name, [AttributeNameValue(k,v) for k,v in res_att_values.items()])]) api.AddResourcesToReservation(reservationContext["id"], [create_res_result.Name]) # Send Trial start notifications api.WriteMessageToReservationOutput(reservationContext["id"], "7. Sending trial start notifications") # Send E-mail to owner + admin email_title = "CloudShell Trial: Trial setup complete" email_body = "Setup of trial for {user} has been completed successfully".format(user=new_username) smtp_client.send_email(",".join([owner_email, admin_email]), email_title, email_body, False) api.AddPermittedUsersToReservation(reservationContext["id"], [owner_email]) api.WriteMessageToReservationOutput(reservationContext["id"], "Trial Started successfully!")
from cloudshell.api.cloudshell_api import CloudShellAPISession user = "******" password = "******" server = "localhost" api = CloudShellAPISession(host=server, username=user, password=password, domain="Training") res = api.CreateImmediateReservation(reservationName="lolol", owner="end_user", durationInMinutes=60) res_id = res.Reservation.Id res = api.AddPermittedUsersToReservation(reservationId=res_id, usernames=["Student A"]) pass