def waitForState(client, instanceid, state): instances = client.get_instances() while instances: for inst in instances['results']: if inst['id'] == instanceid: print inst['state'] if inst['state'] == state: return time.sleep(5) instances = client.get_instances() if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'testuser1', 'admin', 'euca123') print print "=== listing images ===" print images = client.get_images() print images for i in images['results']: if i['id'].find('emi') == 0: emi = i['id'] print "image to run: " + emi print print "=== listing instances ===" print instances = client.get_instances() print instances
# this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() #client.login('localhost', '8888', 'eucalyptus', 'admin', 'admin') client.login('localhost', '8888', 'ec2.us-east-1.amazonaws.com', 'AKIAIFTT7VIH27SUY2BA', 'SECRET') print "=== Getting Buckets ===" print client.get_buckets() print "=== Getting Objects ===" print client.get_objects('admin')
# this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-01', 'admin', 'mypassword2', is_secure=True) client.set_data_interest(['zones']) import time; time.sleep(5) print "=== Getting Zones ===" print client.get_zones() print "=== Getting Regions ===" print client.get_regions()
#!/usr/bin/python from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print print "=== listing addresses ===" print addresses = client.get_addresses() print addresses print print "=== allocate address ===" print addressinfo = client.allocate_address() print addressinfo print print "=== listing keypairs ===" print print client.get_addresses() print print "=== releasing address ===" print print client.release_address(addressinfo['results']['public_ip'])
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print print "=== listing groups ===" print groups = client.get_security_groups() print groups print print "=== creating group ===" print groupinfo = client.create_security_group("test_grp", "group for testing") print groupinfo print print "=== listing groups ===" print print client.get_security_groups()
from uiproxyclient import UIProxyClient def waitForState (client, instanceid, state): instances = client.get_instances() while instances: for inst in instances['results']: if inst['id']==instanceid: print inst['state'] if inst['state'] == state: return; time.sleep(5) instances = client.get_instances() if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print print "=== listing images ===" print images = client.get_images() print images for i in images['results']: if i['id'].find('emi') == 0: emi = i['id'] print "image to run: "+emi print print "=== listing instances ===" print instances = client.get_instances() print instances
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from operator import itemgetter from uiproxyclient import UIProxyClient if __name__ == "__main__": volume_id = 'vol-CC463B31' # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print print "=== listing snapshots ===" print print client.get_snapshots() print print "=== creating snapshot ===" print snapinfo = client.create_snapshot(volume_id) print snapinfo print snapinfo['results']['id'] print snapinfo['results']['status'] snapid = snapinfo['results']['id'] print
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from datetime import datetime from datetime import timedelta from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print "=== Getting Launch Configurations ===" print client.get_all_launch_configurations() # print "=== Create Launch Config ===" # print client.create_launch_configuration('dak-lc', 'emi-C48640C0', instance_type='t1.micro', instance_monitoring='true') # print client.get_all_launch_configurations() print "=== Getting Scaling Groups ===" # print client.get_all_groups() print "=== Create Scaling Group ===" # print client.create_auto_scaling_group('testscalegroup', 'testlaunchconfig', min_size=0, max_size=4, default_cooldown=555, zones=['cluster01']) # print client.get_all_groups() print "=== Set Desired Capacity ===" # print client.set_desired_capacity("testscalegroup", 2) print "=== Create Scaling Policy ===" print client.put_scaling_policy({'name':'testpolicy', 'as_name':'testscalegroup', 'adjustment_type':'ChangeInCapacity', 'scaling_adjustment': '1', 'cooldown': '60'})
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from datetime import datetime from datetime import timedelta from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login("localhost", "8888", "ui-test-acct-03", "admin", "mypassword6") print "=== Getting Launch Configurations ===" print client.get_all_launch_configurations() print "=== Create Launch Config ===" # print client.create_launch_configuration('testlaunchconfig', 'emi-F5373E2F', instance_type='t1.micro', instance_monitoring='true') print client.get_all_launch_configurations() print "=== Getting Scaling Groups ===" print client.get_all_groups() print "=== Create Scaling Group ===" # print client.create_auto_scaling_group('testscalegroup', 'testlaunchconfig', min_size=0, max_size=4, default_cooldown=555, zones=['cluster01']) print client.get_all_groups() print "=== Set Desired Capacity ===" print client.set_desired_capacity("testscalegroup", 2) # print "=== Delete Scaling Group ===" # print client.delete_auto_scaling_group("testscalegroup", force_delete=True)
# with or without modification, are permitted provided that the following # conditions are met: # # Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login("localhost", "8888", "testuser1", "admin", "euca123") print "=== Getting Zones ===" print client.get_zones()
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import time import sys from operator import itemgetter from uiproxyclient import UIProxyClient if __name__ == "__main__": name = "Test_Image-%(t)i" % {"t": time.time()} snapshot_id = None # make some calls to proxy class to test things out client = UIProxyClient() client.login("localhost", "8888", "testuser1", "admin", "euca123") print print "=== getting snapshots ===" print snashosts = client.get_snapshots() if len(snashosts["results"]) > 0: snapshot_id = snashosts["results"][0]["id"] else: sys.exit() print "=== registering snapshot ===" print print "Name: %(n)s" % {"n": name} print "Snapshot id: %(n)s" % {"n": snapshot_id} res = client.register_snapshot_as_image(snapshot_id, name) print "Image ID: %(n)s" % {"n": res["results"]}
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print print "=== listing keypairs ===" print keypairs = client.get_keypairs() print keypairs print print "=== creating keypair ===" print keyinfo = client.create_keypair("testkey01") print keyinfo print print "=== listing keypairs ===" print print client.get_keypairs()
# conditions are met: # # Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword7') print "=== Getting Summary ===" print client.set_data_interest(['images', 'keypairs']) print client.get_dash_summary()
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import time from operator import itemgetter from uiproxyclient import UIProxyClient if __name__ == "__main__": instance_id = 'i-45FD403F' # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print print "=== listing volumes ===" print print client.get_volumes() print print "=== creating volume ===" print volinfo = client.create_volume('1', 'cluster01', None) print volinfo print volinfo['results']['id'] print volinfo['results']['status'] volid = volinfo['results']['id'] print
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print print "=== listing keypairs ===" print keypairs = client.get_keypairs() print keypairs print print "=== creating keypair ===" print keyinfo = client.create_keypair("testkey01") print keyinfo print print "=== listing keypairs ===" print print client.get_keypairs()
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print "=== Getting Launch Configurations ===" print client.get_all_launch_configurations() print "=== Create Launch Config ===" print client.create_launch_configuration('dak-lc', 'emi-C48640C0', instance_type='t1.micro', instance_monitoring='true') print client.get_all_launch_configurations() print "=== Getting Scaling Groups ===" print client.get_all_groups() print "=== Create Scaling Group ===" print client.create_auto_scaling_group('testscalegroup', 'testlaunchconfig',
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from boto.ec2.elb.listener import Listener from boto.ec2.elb.healthcheck import HealthCheck from uiproxyclient import UIProxyClient if __name__ == "__main__": instance_id = 'i-2023dc50' # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ec2.us-east-1.amazonaws.com', 'AKIAIFTT7VIH27SUY2BA', 'SECRET') print "=== Getting Load Balancers ===" print client.get_all_load_balancers() print "=== Create Load Balancer ===" listener = '80', '8888', 'HTTP' print client.create_load_balancer('testbalancer', ['us-east-1d'], [listener]) print client.get_all_load_balancers() print "=== Registering Instance ===" print client.register_instances('testbalancer', [instance_id]) print "=== Configuring Health Check ===" print client.configure_health_check('testbalancer', HealthCheck(target='HTTP:80/hc/test')) print "=== Create LB liistener ===" listener = '2022', '8022', 'TCP' print client.create_load_balancer_listeners('testbalancer', [listener]) print "=== Getting Instance Health ==="
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') # print "=== Getting Metrics ===" # print client.list_metrics() # end = datetime.now() # start = end - timedelta(1) # print client.get_metric_statistics(60, start, end, ['CPUUtilization'], 'AWS/EC2', ['Average'], {'InstanceId':'i-2023dc50'}, 'Percent') print client.describe_alarms() print client.put_metric_alarm(alarm_name='myalarm', metric_name='DiskReadBytes', namespace='AWS/EBS', period='60', threshold='1.0', comparison_op='GreaterThanThreshold', eval_periods='10',
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print print "=== listing keypairs ===" print keypairs = client.get_keypairs() print keypairs print print "=== creating keypair ===" print keyinfo = client.create_keypair("testkey01") print keyinfo print print "=== listing keypairs ===" print
#!/usr/bin/python import time from operator import itemgetter from uiproxyclient import UIProxyClient if __name__ == "__main__": instance_id = 'i-45FD403F' # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print print "=== listing volumes ===" print print client.get_volumes() print print "=== creating volume ===" print volinfo = client.create_volume('1', 'PARTI00', None) print volinfo print volinfo['results']['id'] print volinfo['results']['status'] volid = volinfo['results']['id'] print print "=== listing volumes ===" print volumes = client.get_volumes() print volumes print
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-01', 'admin', 'mypassword2', is_secure=True) client.set_data_interest(['zones']) import time time.sleep(5) print "=== Getting Zones ===" print client.get_zones() print "=== Getting Regions ===" print client.get_regions()
# documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from datetime import datetime from datetime import timedelta from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') # print "=== Getting Metrics ===" # print client.list_metrics() # end = datetime.now() # start = end - timedelta(1) # print client.get_metric_statistics(60, start, end, ['CPUUtilization'], 'AWS/EC2', ['Average'], {'InstanceId':'i-2023dc50'}, 'Percent') print client.describe_alarms() print client.put_metric_alarm(alarm_name='myalarm', metric_name='DiskReadBytes', namespace='AWS/EBS', period='60', threshold='1.0', comparison_op='GreaterThanThreshold', eval_periods='10', statistic='Sum') print client.describe_alarms()
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword7') print "=== Getting Tags ===" print client.get_tags() # print "=== Creating Tag ===" # print client.create_tags(['ami-d54d8fbc'], {'Purpose':'PuppetDev'}) # print client.get_tags() # print "=== Deleting Tag ===" # print client.delete_tags(['ami-d54d8fbc'], {'Purpose':'PuppetDev'}) # print client.get_tags() # print "=== Getting filtered images ===" # print client.get_images({'tag:Purpose':'LifeguardDevel'}); print client.get_tags({'resource-type': 'volume'})
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from boto.ec2.elb.healthcheck import HealthCheck from uiproxyclient import UIProxyClient if __name__ == "__main__": instance_id = "i-2023dc50" # make some calls to proxy class to test things out client = UIProxyClient() client.login("localhost", "8888", "ui-test-acct-03", "admin", "mypassword6") print "=== Getting Load Balancers ===" print client.get_all_load_balancers() print "=== Create Load Balancer ===" listener = "80", "8888", "HTTP" print client.create_load_balancer("testbalancer", ["cluster01"], [listener]) print client.get_all_load_balancers() print "=== Registering Instance ===" print client.register_instances("testbalancer", [instance_id]) print "=== Configuring Health Check ===" print client.configure_health_check("testbalancer", HealthCheck(target="HTTP:80/hc/test")) print "=== Create LB liistener ===" listener = "2022", "8022", "TCP" print client.create_load_balancer_listeners("testbalancer", [listener]) print "=== Getting Instance Health ==="
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from boto.ec2.elb.listener import Listener from boto.ec2.elb.healthcheck import HealthCheck from uiproxyclient import UIProxyClient if __name__ == "__main__": instance_id = 'i-2023dc50' # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ec2.us-east-1.amazonaws.com', 'AKIAIFTT7VIH27SUY2BA', 'SECRET') print "=== Getting Load Balancers ===" print client.get_all_load_balancers() print "=== Create Load Balancer ===" listener = '80', '8888', 'HTTP' print client.create_load_balancer('testbalancer', ['us-east-1d'], [listener]) print client.get_all_load_balancers() print "=== Registering Instance ===" print client.register_instances('testbalancer', [instance_id]) print "=== Configuring Health Check ===" print client.configure_health_check('testbalancer', HealthCheck(target='HTTP:80/hc/test')) print "=== Create LB liistener ==="
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from datetime import datetime from datetime import timedelta from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print "=== Getting Launch Configurations ===" print client.get_all_launch_configurations() print "=== Create Launch Config ===" # print client.create_launch_configuration('testlaunchconfig', 'emi-F5373E2F', instance_type='t1.micro', instance_monitoring='true') print client.get_all_launch_configurations() print "=== Getting Scaling Groups ===" print client.get_all_groups() print "=== Create Scaling Group ===" # print client.create_auto_scaling_group('testscalegroup', 'testlaunchconfig', min_size=0, max_size=4, default_cooldown=555, zones=['cluster01']) print client.get_all_groups() print "=== Set Desired Capacity ===" print client.set_desired_capacity("testscalegroup", 2) # print "=== Delete Scaling Group ==="
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import time from operator import itemgetter from uiproxyclient import UIProxyClient if __name__ == "__main__": image_id = 'emi-F2043872' # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print print "=== listing images ===" print print client.get_images() print print print "=== getting image attribute ===" print print client.get_image_attribute(image_id) print print "=== setting image attribute ===" print print client.modify_image_attribute(image_id, groups=['all'], attribute='launchPermission', operation='remove')
# # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from datetime import datetime from datetime import timedelta from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ec2.us-east-1.amazonaws.com', 'AKIAIFTT7VIH27SUY2BA', 'SECRET HERE') print "=== Getting Metrics ===" print client.list_metrics() end = datetime.now() start = end - timedelta(1) print client.get_metric_statistics(60, start, end, ['CPUUtilization'], 'AWS/EC2', ['Average'], {'InstanceId':'i-2023dc50'}, 'Percent')
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from datetime import datetime from datetime import timedelta from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print "=== Getting Launch Configurations ===" print client.get_all_launch_configurations() # print "=== Create Launch Config ===" # print client.create_launch_configuration('dak-lc', 'emi-C48640C0', instance_type='t1.micro', instance_monitoring='true') # print client.get_all_launch_configurations() print "=== Getting Scaling Groups ===" # print client.get_all_groups() print "=== Create Scaling Group ===" # print client.create_auto_scaling_group('testscalegroup', 'testlaunchconfig', min_size=0, max_size=4, default_cooldown=555, zones=['cluster01']) # print client.get_all_groups() print "=== Set Desired Capacity ===" # print client.set_desired_capacity("testscalegroup", 2) print "=== Create Scaling Policy ==="
# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from boto.ec2.elb.listener import Listener from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ec2.us-east-1.amazonaws.com', 'AKIAIFTT7VIH27SUY2BA', 'SECRET') print "=== Getting Load Balancers ===" print client.get_all_load_balancers() print "=== Create Load Balancer ===" listener = Listener(load_balancer_port='80', instance_port='8888', protocol='HTTP') print client.create_load_balancer("testbalancer", ['us-east-1a'], [listener]) print client.get_all_load_balancers() print "=== Getting Instance Health ===" print client.describe_instance_health('testbalancer') print "=== Delete Load Balancer ===" print client.delete_load_balancer('testbalancer')
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from datetime import datetime from datetime import timedelta from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ec2.us-east-1.amazonaws.com', 'AKIAIFTT7VIH27SUY2BA', 'SECRET KEY') print "=== Getting Launch Configurations ===" print client.get_all_launch_configurations() print "=== Create Launch Config ===" print client.create_launch_configuration('testlaunchconfig', 'ami-1624987f', instance_type='t1.micro', instance_monitoring='true') print client.get_all_launch_configurations() print "=== Getting Scaling Groups ===" print client.get_all_groups() print "=== Create Scaling Group ===" print client.create_auto_scaling_group('testscalegroup', 'testlaunchconfig', min_size=0, max_size=4, default_cooldown=555, zones=['us-east-1a']) print client.get_all_groups() print "=== Set Desired Capacity ===" print client.set_desired_capacity("testscalegroup", 2) print "=== Delete Scaling Group ===" print client.delete_auto_scaling_group("testscalegroup", force_delete=True)
# with or without modification, are permitted provided that the following # conditions are met: # # Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'testuser1', 'admin', 'euca123') print "=== Getting Zones ===" print client.get_zones()
def waitForState(client, instanceid, state): instances = client.get_instances() while instances: for inst in instances['results']: if inst['id'] == instanceid: print inst['state'] if inst['state'] == state: return time.sleep(5) instances = client.get_instances() if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print print "=== listing images ===" print images = client.get_images() print images for i in images['results']: if i['id'].find('emi') == 0: emi = i['id'] print "image to run: " + emi print print "=== listing instances ===" print instances = client.get_instances()
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import time import sys from uiproxyclient import UIProxyClient if __name__ == "__main__": name = 'Test_Image-%(t)i' % {'t': time.time()} snapshot_id = None # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'testuser1', 'admin', 'euca123') print print "=== getting snapshots ===" print snashosts = client.get_snapshots() if len(snashosts['results']) > 0: snapshot_id = snashosts['results'][0]['id'] else: sys.exit() print "=== registering snapshot ===" print print 'Name: %(n)s' % {'n': name} print 'Snapshot id: %(n)s' % {'n': snapshot_id} res = client.register_snapshot_as_image(snapshot_id, name) print 'Image ID: %(n)s' % {'n': res['results']}
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from boto.ec2.elb.listener import Listener from boto.ec2.elb.healthcheck import HealthCheck from uiproxyclient import UIProxyClient if __name__ == "__main__": instance_id = 'i-2023dc50' # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print "=== Getting Load Balancers ===" print client.get_all_load_balancers() print "=== Create Load Balancer ===" listener = '80', '8888', 'HTTP' print client.create_load_balancer('testbalancer', ['cluster01'], [listener]) print client.get_all_load_balancers() print "=== Registering Instance ===" print client.register_instances('testbalancer', [instance_id]) print "=== Configuring Health Check ===" print client.configure_health_check('testbalancer', HealthCheck(target='HTTP:80/hc/test')) print "=== Create LB liistener ===" listener = '2022', '8022', 'TCP' print client.create_load_balancer_listeners('testbalancer', [listener]) print "=== Getting Instance Health ==="
# documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from datetime import datetime from datetime import timedelta from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ec2.us-east-1.amazonaws.com', 'AKIAIFTT7VIH27SUY2BA', 'SECRET HERE') print "=== Getting Metrics ===" print client.list_metrics() end = datetime.now() start = end - timedelta(1) print client.get_metric_statistics(60, start, end, ['CPUUtilization'], 'AWS/EC2', ['Average'], {'InstanceId': 'i-2023dc50'}, 'Percent')
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from boto.ec2.elb.healthcheck import HealthCheck from uiproxyclient import UIProxyClient if __name__ == "__main__": instance_id = 'i-2023dc50' # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print "=== Getting Load Balancers ===" print client.get_all_load_balancers() print "=== Create Load Balancer ===" listener = '80', '8888', 'HTTP' print client.create_load_balancer('testbalancer', ['cluster01'], [listener]) print client.get_all_load_balancers() print "=== Registering Instance ===" print client.register_instances('testbalancer', [instance_id]) print "=== Configuring Health Check ===" print client.configure_health_check('testbalancer', HealthCheck(target='HTTP:80/hc/test')) print "=== Create LB liistener ==="
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from datetime import datetime from datetime import timedelta from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ec2.us-east-1.amazonaws.com', 'AKIAIFTT7VIH27SUY2BA', 'SECRET KEY') print "=== Getting Launch Configurations ===" print client.get_all_launch_configurations() print "=== Create Launch Config ===" print client.create_launch_configuration('testlaunchconfig', 'ami-1624987f', instance_type='t1.micro', instance_monitoring='true') print client.get_all_launch_configurations() print "=== Getting Scaling Groups ===" print client.get_all_groups() print "=== Create Scaling Group ===" print client.create_auto_scaling_group('testscalegroup', 'testlaunchconfig',
# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword7') print "=== Getting Tags ===" print client.get_tags() # print "=== Creating Tag ===" # print client.create_tags(['ami-d54d8fbc'], {'Purpose':'PuppetDev'}) # print client.get_tags() # print "=== Deleting Tag ===" # print client.delete_tags(['ami-d54d8fbc'], {'Purpose':'PuppetDev'}) # print client.get_tags() # print "=== Getting filtered images ===" # print client.get_images({'tag:Purpose':'LifeguardDevel'}); print client.get_tags({'resource-type': 'volume'})
from uiproxyclient import UIProxyClient def waitForState (client, instanceid, state): instances = client.get_instances() while instances: for inst in instances['results']: if inst['id']==instanceid: print inst['state'] if inst['state'] == state: return; time.sleep(5) instances = client.get_instances() if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'testuser1', 'admin', 'euca123') print print "=== listing images ===" print images = client.get_images() print images for i in images['results']: if i['id'].find('emi') == 0: emi = i['id'] print "image to run: "+emi print print "=== listing instances ===" print instances = client.get_instances() print instances
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient from datetime import datetime, timedelta if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print "=== Getting Zones, again and again ===" iter = 0 sec_iter = 0 start = datetime.now() while True: zones = client.get_zones() iter = iter+1 sec_iter = sec_iter+1 if (datetime.now() - start) > timedelta(seconds=1): print "req/sec: "+str(sec_iter) sec_iter = 0 start = datetime.now()
# Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() #client.login('localhost', '8888', 'eucalyptus', 'admin', 'admin') client.login('localhost', '8888', 'ec2.us-east-1.amazonaws.com', 'AKIAIFTT7VIH27SUY2BA', 'SECRET') print "=== Getting Buckets ===" print client.get_buckets() print "=== Getting Objects ===" print client.get_objects('admin')
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login("localhost", "8888", "ui-test-acct-03", "admin", "mypassword6") # print "=== Getting Metrics ===" # print client.list_metrics() # end = datetime.now() # start = end - timedelta(1) # print client.get_metric_statistics(60, start, end, ['CPUUtilization'], 'AWS/EC2', ['Average'], {'InstanceId':'i-2023dc50'}, 'Percent') print client.describe_alarms() print client.put_metric_alarm( alarm_name="myalarm", metric_name="DiskReadBytes", namespace="AWS/EBS", period="60", threshold="1.0", comparison_op="GreaterThanThreshold", eval_periods="10",
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": image_id = 'emi-F2043872' # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print print "=== listing images ===" print print client.get_images() print print print "=== getting image attribute ===" print print client.get_image_attribute(image_id) print print "=== setting image attribute ===" print print client.modify_image_attribute(image_id,
# # Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'eucalyptus', 'admin', 'admin') print "=== Getting Buckets ===" print client.get_buckets() print "=== Getting Objects ===" print client.get_objects('admin')
# # Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword7') print "=== Getting Summary ===" print client.set_data_interest(['images', 'keypairs']) print client.get_dash_summary()
# documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'testuser1', 'admin', 'euca123') print "=== Getting Tags ===" print client.get_tags() # print "=== Creating Tag ===" # print client.create_tags(['ami-d54d8fbc'], {'Purpose':'PuppetDev'}) # print client.get_tags() # print "=== Deleting Tag ===" # print client.delete_tags(['ami-d54d8fbc'], {'Purpose':'PuppetDev'}) # print client.get_tags() # print "=== Getting filtered images ===" # print client.get_images({'tag:Purpose':'LifeguardDevel'});
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print print "=== listing addresses ===" print addresses = client.get_addresses() print addresses print print "=== allocate address ===" print addressinfo = client.allocate_address() print addressinfo print print "=== listing keypairs ===" print print client.get_addresses()
#!/usr/bin/python from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'test', 'admin', 'testing123') print print "=== listing groups ===" print groups = client.get_security_groups() print groups print print "=== creating group ===" print groupinfo = client.create_security_group("test_grp", "group for testing") print groupinfo print print "=== listing groups ===" print print client.get_security_groups() print print "=== authorizing port 22 ingress ===" print print client.authorize_security_group(name="test_grp", ip_protocol=['tcp', 'tcp'], from_port=['22', '22'], to_port=['22', '22'], cidr_ip=['10.0.0.0/24', '10.20.30.0/24']) print
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from uiproxyclient import UIProxyClient if __name__ == "__main__": # make some calls to proxy class to test things out client = UIProxyClient() client.login('localhost', '8888', 'ui-test-acct-03', 'admin', 'mypassword6') print "=== Getting Launch Configurations ===" print client.get_all_launch_configurations() print "=== Create Launch Config ===" print client.create_launch_configuration('dak-lc', 'emi-C48640C0', instance_type='t1.micro', instance_monitoring='true') print client.get_all_launch_configurations() print "=== Getting Scaling Groups ===" print client.get_all_groups() print "=== Create Scaling Group ===" print client.create_auto_scaling_group('testscalegroup', 'testlaunchconfig', min_size=0, max_size=4, default_cooldown=555, zones=['cluster01']) print client.get_all_groups() print "=== Set Desired Capacity ===" print client.set_desired_capacity("testscalegroup", 2)