internal void LoadItemsFromManifest(AddonManifest manifest) { try { var manifestProperties = manifest.GetProperties(); foreach (var manifestProperty in manifestProperties) { //Console.WriteLine("Debug- manifestProperty Key: " + manifestProperty.DisplayName + " Value: " + manifestProperty.Value); switch (manifestProperty.Key.Trim().ToLowerInvariant()) { case ("acesskey"): AccessKey = manifestProperty.Value; break; case ("secretkey"): SecretAccessKey = manifestProperty.Value; break; case ("useclientregion"): bool tmp; bool.TryParse(manifestProperty.Value, out tmp); UseClientRegion = tmp; break; case ("regionEndpoint"): RegionEndpont = manifestProperty.Value; break; case ("amiid"): AmiId = manifestProperty.Value; break; case ("ec2keypair"): Ec2KeyPair = manifestProperty.Value; break; case ("securityGroups"): SecurityGroupId = manifestProperty.Value; break; case ("defaultinstancetype"): InstanceType = manifestProperty.Value; break; case ("instancecommonname"): InstanceCommonName = manifestProperty.Value; break; default: // means there are other manifest properties we don't need. Console.WriteLine("Key not added: " + manifestProperty.DisplayName); break; } } } catch (Exception e) { throw new Exception(e.Message + "\n Debug information: " + manifest.GetProperties()); } }
private OperationResult ParseDevOptions(string developerOptions, AddonManifest manifest, out DeveloperOptions devOptions) { devOptions = null; var result = new OperationResult() { IsSuccess = false }; var progress = ""; try { progress += "Parsing developer options...\n"; devOptions = DeveloperOptions.Parse(developerOptions); // we're probably going to need these lines a few times Dictionary <string, string> manifestProperties = manifest.GetProperties().ToDictionary(x => x.Key, x => x.Value); devOptions.AccessKey = manifestProperties["AWSClientKey"]; devOptions.SecretAccessKey = manifestProperties["AWSSecretKey"]; devOptions.AccountId = manifestProperties["AWSAccountID"]; //devOptions.RegionEndpoint = manifestProperties["RegionEndpoint"]; } catch (ArgumentException e) { result.EndUserMessage = e.Message; return(result); } result.IsSuccess = true; result.EndUserMessage = progress; return(result); }
private OperationResult EstablishClient(AddonManifest manifest, DeveloperOptions devOptions, out AmazonSimpleNotificationServiceClient client) { OperationResult result; bool requireCreds; var manifestprops = manifest.GetProperties().ToDictionary(x => x.Key, x => x.Value); var AccessKey = manifestprops["AWSClientKey"]; var SecretAccessKey = manifestprops["AWSSecretKey"]; var _RegionEndpoint = manifestprops["AWSRegionEndpoint"]; var prop = manifest.Properties.First( p => p.Key.Equals("requireDevCredentials", StringComparison.InvariantCultureIgnoreCase)); if (bool.TryParse(prop.Value, out requireCreds) && requireCreds) { if (!ValidateDevCreds(devOptions)) { client = null; result = new OperationResult() { IsSuccess = false, EndUserMessage = "The add on requires that developer credentials are specified but none were provided." }; return(result); } //accessKey = devOptions.AccessKey; //secretAccessKey = devOptions.SecretAccessKey; } AmazonSimpleNotificationServiceConfig config = new AmazonSimpleNotificationServiceConfig() { RegionEndpoint = RegionEndpoint.USEast1 }; client = new AmazonSimpleNotificationServiceClient(AccessKey, SecretAccessKey, config); result = new OperationResult { IsSuccess = true }; return(result); }
internal InstanceOperations(AddonManifest manifest, GoogleCloudDeveloperOptions developerOptions) { try { var manifestprops = manifest.GetProperties().ToDictionary(x => x.Key, x => x.Value); ProjectId = manifestprops["ProjectID"]; ServiceAccountEmail = manifestprops["Email"]; CertificateFile = manifestprops["CertFile"]; InstanceName = developerOptions.InstanceName; SourceImage = developerOptions.SourceImage; DiskType = developerOptions.DiskType; Zone = developerOptions.Zone; MachineType = developerOptions.MachineType; SourceImageProject = developerOptions.SourceImageProject; } catch (Exception e) { throw new ArgumentException("Argument syntax is incorrect - " + e.Message); } }
public static DeveloperParameters LoadItemsFromManifest(DeveloperParameters parameters, AddonManifest manifest) { try { var manifestProperties = manifest.GetProperties(); foreach (var manifestProperty in manifestProperties) { switch (manifestProperty.Key.Trim().ToLowerInvariant()) { case ("vserver"): parameters.VServer = manifestProperty.Value; break; case ("adminusername"): parameters.AdminUserName = manifestProperty.Value; break; case ("adminpassword"): parameters.AdminPassword = manifestProperty.Value; break; case ("clustermgtendpoint"): parameters.ClusterMgtEndpoint = manifestProperty.Value; break; case ("defaultprotocol"): parameters.VolumeToProvision.Protocol = manifestProperty.Value; break; case ("defaultaggregate"): parameters.VolumeToProvision.AggregateName = manifestProperty.Value; break; case ("defaultrootpath"): parameters.VolumeToProvision.JunctionPath = manifestProperty.Value; break; case ("snapenable"): bool snaptest; bool.TryParse(manifestProperty.Value, out snaptest); parameters.VolumeToProvision.SnapEnable = snaptest; break; case ("vaultenable"): bool test; bool.TryParse(manifestProperty.Value, out test); parameters.VolumeToProvision.VaultEnable = test; break; case ("snapshotschedule"): parameters.VolumeToProvision.SnapshotSchedule = manifestProperty.Value; break; case ("defaultacl"): break; case ("snapmirrorpolicyname"): parameters.VolumeToProvision.SnapMirrorPolicyName = manifestProperty.Value; break; case ("snapvaultpolicyname"): parameters.VolumeToProvision.SnapVaultPolicyName = manifestProperty.Value; break; case ("snapmirrorschedule"): parameters.VolumeToProvision.SnapMirrorSchedule = manifestProperty.Value; break; case ("snapvaultschedule"): parameters.VolumeToProvision.SnapVaultSchedule = manifestProperty.Value; break; case ("snaptype"): parameters.VolumeToProvision.SnapType = manifestProperty.Value; break; case ("shareendpoint"): parameters.VolumeToProvision.CifsRootServer = manifestProperty.Value; break; case ("scriptrepotype"): parameters.ScriptRepositoryType = manifestProperty.Value; break; case ("scriptrepo"): parameters.ScriptRepository = manifestProperty.Value; break; case ("maxallocatedstorage"): parameters.MaxAllocatedStorage = manifestProperty.Value; break; default: // means there are other manifest properties we don't need. Console.WriteLine("Parse failed on key: " + manifestProperty.Key); break; } } return(parameters); } catch (Exception e) { throw new Exception(e.Message + "\n Debug information: " + manifest.GetProperties()); } }
private OperationResult EstablishClient(AddonManifest manifest, DeveloperOptions devOptions, out AmazonSimpleNotificationServiceClient client) { OperationResult result; bool requireCreds; var manifestprops = manifest.GetProperties().ToDictionary(x => x.Key, x => x.Value); var AccessKey = manifestprops["AWSClientKey"]; var SecretAccessKey = manifestprops["AWSSecretKey"]; var _RegionEndpoint = manifestprops["AWSRegionEndpoint"]; var prop = manifest.Properties.First( p => p.Key.Equals("requireDevCredentials", StringComparison.InvariantCultureIgnoreCase)); if (bool.TryParse(prop.Value, out requireCreds) && requireCreds) { if (!ValidateDevCreds(devOptions)) { client = null; result = new OperationResult() { IsSuccess = false, EndUserMessage = "The add on requires that developer credentials are specified but none were provided." }; return result; } //accessKey = devOptions.AccessKey; //secretAccessKey = devOptions.SecretAccessKey; } AmazonSimpleNotificationServiceConfig config = new AmazonSimpleNotificationServiceConfig() { RegionEndpoint = RegionEndpoint.USEast1 }; client = new AmazonSimpleNotificationServiceClient(AccessKey, SecretAccessKey, config); result = new OperationResult { IsSuccess = true }; return result; }
private OperationResult ParseDevOptions(string developerOptions, AddonManifest manifest, out DeveloperOptions devOptions) { devOptions = null; var result = new OperationResult() { IsSuccess = false }; var progress = ""; try { progress += "Parsing developer options...\n"; devOptions = DeveloperOptions.Parse(developerOptions); // we're probably going to need these lines a few times Dictionary<string, string> manifestProperties = manifest.GetProperties().ToDictionary(x => x.Key, x => x.Value); devOptions.AccessKey = manifestProperties["AWSClientKey"]; devOptions.SecretAccessKey = manifestProperties["AWSSecretKey"]; devOptions.AccountId = manifestProperties["AWSAccountID"]; //devOptions.RegionEndpoint = manifestProperties["RegionEndpoint"]; } catch (ArgumentException e) { result.EndUserMessage = e.Message; return result; } result.IsSuccess = true; result.EndUserMessage = progress; return result; }
public static DeveloperParameters LoadItemsFromManifest(DeveloperParameters parameters, AddonManifest manifest) { try { var manifestProperties = manifest.GetProperties(); foreach (var manifestProperty in manifestProperties) { switch (manifestProperty.Key.Trim().ToLowerInvariant()) { case ("vserver"): parameters.VServer = manifestProperty.Value; break; case ("adminusername"): parameters.AdminUserName = manifestProperty.Value; break; case ("adminpassword"): parameters.AdminPassword = manifestProperty.Value; break; case ("clustermgtendpoint"): parameters.ClusterMgtEndpoint = manifestProperty.Value; break; case ("defaultprotocol"): parameters.VolumeToProvision.Protocol = manifestProperty.Value; break; case ("defaultaggregate"): parameters.VolumeToProvision.AggregateName = manifestProperty.Value; break; case ("defaultrootpath"): parameters.VolumeToProvision.JunctionPath = manifestProperty.Value; break; case ("snapenable"): bool snaptest; bool.TryParse(manifestProperty.Value, out snaptest); parameters.VolumeToProvision.SnapEnable = snaptest; break; case ("vaultenable"): bool test; bool.TryParse(manifestProperty.Value, out test); parameters.VolumeToProvision.VaultEnable = test; break; case ("snapshotschedule"): parameters.VolumeToProvision.SnapshotSchedule = manifestProperty.Value; break; case ("defaultacl"): break; case ("snapmirrorpolicyname"): parameters.VolumeToProvision.SnapMirrorPolicyName = manifestProperty.Value; break; case ("snapvaultpolicyname"): parameters.VolumeToProvision.SnapVaultPolicyName = manifestProperty.Value; break; case ("snapmirrorschedule"): parameters.VolumeToProvision.SnapMirrorSchedule = manifestProperty.Value; break; case ("snapvaultschedule"): parameters.VolumeToProvision.SnapVaultSchedule = manifestProperty.Value; break; case ("snaptype"): parameters.VolumeToProvision.SnapType = manifestProperty.Value; break; case ("shareendpoint"): parameters.VolumeToProvision.CifsRootServer = manifestProperty.Value; break; case ("scriptrepotype"): parameters.ScriptRepositoryType = manifestProperty.Value; break; case ("scriptrepo"): parameters.ScriptRepository = manifestProperty.Value; break; case ("maxallocatedstorage"): parameters.MaxAllocatedStorage = manifestProperty.Value; break; default: // means there are other manifest properties we don't need. Console.WriteLine("Parse failed on key: " + manifestProperty.Key); break; } } return parameters; } catch (Exception e) { throw new Exception(e.Message + "\n Debug information: " + manifest.GetProperties()); } }