def Run(self, args): """Issues the request to create a new SSL policy.""" holder = base_classes.ComputeApiHolder(self.ReleaseTrack()) helper = ssl_policies_utils.SslPolicyHelper(holder) ssl_policy_ref = _SSL_POLICY_ARG.ResolveAsResource(args, holder.resources) custom_features = args.custom_features if args.IsSpecified( 'custom_features') else [] ssl_policy_to_insert = helper.GetSslPolicyForInsert( name=ssl_policy_ref.Name(), description=args.description, profile=args.profile, min_tls_version=flags.ParseTlsVersion(args.min_tls_version), custom_features=custom_features) operation_ref = helper.Create(ssl_policy_ref, ssl_policy_to_insert) return helper.WaitForOperation(ssl_policy_ref, operation_ref, 'Creating SSL policy')
def Run(self, args): """Issues the request to update a SSL policy.""" holder = base_classes.ComputeApiHolder(self.ReleaseTrack()) helper = ssl_policies_utils.SslPolicyHelper(holder) ssl_policy_ref = _SSL_POLICY_ARG.ResolveAsResource(args, holder.resources) include_custom_features, custom_features = Update._GetCustomFeatures(args) existing_ssl_policy = helper.Describe(ssl_policy_ref) patch_ssl_policy = helper.GetSslPolicyForPatch( fingerprint=existing_ssl_policy.fingerprint, profile=args.profile, min_tls_version=flags.ParseTlsVersion(args.min_tls_version), custom_features=custom_features) operation_ref = helper.Patch( ssl_policy_ref, patch_ssl_policy, include_custom_features and not custom_features) return helper.WaitForOperation(ssl_policy_ref, operation_ref, 'Updating SSL policy')